feat(auth): add update profile method to useAuth composable
This commit is contained in:
@@ -4,7 +4,7 @@ import type {
|
|||||||
OkResponse,
|
OkResponse,
|
||||||
OtpRequestResponse, PasswordLoginRequest, RegisterCitizenRequest,
|
OtpRequestResponse, PasswordLoginRequest, RegisterCitizenRequest,
|
||||||
RegisterCitizenResponse, RewardsResponse,
|
RegisterCitizenResponse, RewardsResponse,
|
||||||
TokenResponse, VerifyOtpRequest
|
TokenResponse, VerifyOtpRequest, UpdateProfileRequest
|
||||||
} from "~/types/api";
|
} from "~/types/api";
|
||||||
|
|
||||||
export const useAuth = () => {
|
export const useAuth = () => {
|
||||||
@@ -81,6 +81,9 @@ export const useAuth = () => {
|
|||||||
const changePassword = (body: ChangePasswordRequest) =>
|
const changePassword = (body: ChangePasswordRequest) =>
|
||||||
useApiFetch<OkResponse>('/api/v1/auth/change-password', { method: 'POST', body })
|
useApiFetch<OkResponse>('/api/v1/auth/change-password', { method: 'POST', body })
|
||||||
|
|
||||||
|
const updateProfile = (body: UpdateProfileRequest) =>
|
||||||
|
useApiFetch<CurrentUserResponse>('/api/v1/me', { method: 'PATCH', body })
|
||||||
|
|
||||||
const fetchCurrentUser = () =>
|
const fetchCurrentUser = () =>
|
||||||
useApiFetch<CurrentUserResponse>('/api/v1/me', { method: 'GET' })
|
useApiFetch<CurrentUserResponse>('/api/v1/me', { method: 'GET' })
|
||||||
|
|
||||||
@@ -108,6 +111,7 @@ export const useAuth = () => {
|
|||||||
verifyOtp,
|
verifyOtp,
|
||||||
loginWithPassword,
|
loginWithPassword,
|
||||||
changePassword,
|
changePassword,
|
||||||
|
updateProfile,
|
||||||
fetchCurrentUser,
|
fetchCurrentUser,
|
||||||
fetchRewards,
|
fetchRewards,
|
||||||
fetchNotifications,
|
fetchNotifications,
|
||||||
|
|||||||
Reference in New Issue
Block a user