fix(settings): enable profile save and avatar selection
This commit is contained in:
@@ -12,6 +12,7 @@ interface AuthState {
|
||||
submitVerification: (role: UserRole) => void
|
||||
approveVerification: (role: UserRole) => void
|
||||
rejectVerification: (role: UserRole, reason: string) => void
|
||||
updateProfile: (patch: { nickname?: string; bio?: string; avatar?: string }) => void
|
||||
login: (user: User, verifiedRoles?: UserRole[]) => void
|
||||
logout: () => void
|
||||
}
|
||||
@@ -83,6 +84,19 @@ export const useAuthStore = create<AuthState>((set, get) => ({
|
||||
},
|
||||
}
|
||||
}),
|
||||
updateProfile: (patch) =>
|
||||
set((state) => {
|
||||
if (!state.user) return state
|
||||
|
||||
return {
|
||||
user: {
|
||||
...state.user,
|
||||
nickname: patch.nickname ?? state.user.nickname,
|
||||
bio: patch.bio ?? state.user.bio,
|
||||
avatar: patch.avatar ?? state.user.avatar,
|
||||
},
|
||||
}
|
||||
}),
|
||||
login: (user, verifiedRoles = ["consumer"]) =>
|
||||
set({
|
||||
isAuthenticated: true,
|
||||
|
||||
Reference in New Issue
Block a user