refractor(auth): removed password from everywhere

This commit is contained in:
gabdevele
2026-06-16 11:53:22 +02:00 Unverified
parent bb50b5ca6a
commit b75e7bbafd
9 changed files with 37 additions and 359 deletions
+2 -13
View File
@@ -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,