feat: replace settings with a full page
This commit is contained in:
@@ -8,6 +8,7 @@ export enum AuthError {
|
||||
SignInFailed = 'SIGN_IN_FAILED',
|
||||
SignUpFailed = 'SIGN_UP_FAILED',
|
||||
SignOutFailed = 'SIGN_OUT_FAILED',
|
||||
UpdateFailed = 'UPDATE_FAILED',
|
||||
NetworkError = 'NETWORK_ERROR',
|
||||
}
|
||||
|
||||
@@ -166,6 +167,28 @@ export const useAuth = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const updateProfile = async (
|
||||
updates: { name?: string; image?: string | null }
|
||||
): Promise<Result<void, AuthError>> => {
|
||||
try {
|
||||
const { error } = await authClient.updateUser(updates);
|
||||
|
||||
if (error) {
|
||||
console.error('Profile update failed:', error);
|
||||
return Err(AuthError.UpdateFailed);
|
||||
}
|
||||
|
||||
if (user.value) {
|
||||
user.value = { ...user.value, ...updates };
|
||||
}
|
||||
|
||||
return Ok(undefined);
|
||||
} catch (err) {
|
||||
console.error('Profile update error:', err);
|
||||
return Err(AuthError.NetworkError);
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
client: authClient,
|
||||
session,
|
||||
@@ -174,6 +197,7 @@ export const useAuth = () => {
|
||||
signIn,
|
||||
signUp,
|
||||
signOut,
|
||||
updateProfile,
|
||||
fetchSession,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Err, Ok, type Result } from "~~/types/result";
|
||||
|
||||
export enum DialogType {
|
||||
Settings = 'settings',
|
||||
Textbox = 'textbox',
|
||||
QuickSwitcher = 'quick-switcher',
|
||||
Confirm = 'confirm',
|
||||
|
||||
Reference in New Issue
Block a user