refractor(auth): removed password from everywhere
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import type {
|
||||
ChangePasswordRequest,
|
||||
CurrentUserResponse, EmailRequest, NotificationListResponse,
|
||||
OkResponse,
|
||||
OtpRequestResponse, PasswordLoginRequest, RegisterCitizenRequest,
|
||||
OtpRequestResponse, RegisterCitizenRequest,
|
||||
RegisterCitizenResponse, RewardsResponse,
|
||||
TokenResponse, VerifyOtpRequest, UpdateProfileRequest
|
||||
} from "~/types/api";
|
||||
@@ -44,9 +43,7 @@ export const useAuth = () => {
|
||||
user.value = res.user
|
||||
const path = currentPath ?? useNuxtApp().$router.currentRoute.value.path
|
||||
|
||||
if (res.user.must_change_password && path !== '/auth/change-password') {
|
||||
await nuxtApp.runWithContext(() => navigateTo('/auth/change-password'))
|
||||
} else if (redirectOnSuccess && path.startsWith('/auth')) {
|
||||
if (redirectOnSuccess && path.startsWith('/auth')) {
|
||||
await nuxtApp.runWithContext(() => navigateTo('/dashboard'))
|
||||
}
|
||||
}
|
||||
@@ -85,12 +82,6 @@ export const useAuth = () => {
|
||||
const verifyOtp = (body: VerifyOtpRequest) =>
|
||||
useApiFetch<TokenResponse>('/api/v1/auth/otp/verify', { method: 'POST', body })
|
||||
|
||||
const loginWithPassword = (body: PasswordLoginRequest) =>
|
||||
useApiFetch<TokenResponse>('/api/v1/auth/login/password', { method: 'POST', body })
|
||||
|
||||
const changePassword = (body: ChangePasswordRequest) =>
|
||||
useApiFetch<OkResponse>('/api/v1/auth/change-password', { method: 'POST', body })
|
||||
|
||||
const updateProfile = (body: UpdateProfileRequest) =>
|
||||
useApiFetch<CurrentUserResponse>('/api/v1/me', { method: 'PATCH', body })
|
||||
|
||||
@@ -119,8 +110,6 @@ export const useAuth = () => {
|
||||
register,
|
||||
requestOtp,
|
||||
verifyOtp,
|
||||
loginWithPassword,
|
||||
changePassword,
|
||||
updateProfile,
|
||||
fetchCurrentUser,
|
||||
fetchRewards,
|
||||
|
||||
Reference in New Issue
Block a user