diff --git a/apps/stage-web/src/pages/auth/login.vue b/apps/stage-web/src/pages/auth/login.vue index 8bf69b67c..603c903bc 100644 --- a/apps/stage-web/src/pages/auth/login.vue +++ b/apps/stage-web/src/pages/auth/login.vue @@ -1,27 +1,34 @@ @@ -39,18 +49,18 @@ async function handleSignIn(provider: 'google' | 'github') {
diff --git a/packages/stage-ui/src/libs/auth.ts b/packages/stage-ui/src/libs/auth.ts index 8f5746483..a71d72caf 100644 --- a/packages/stage-ui/src/libs/auth.ts +++ b/packages/stage-ui/src/libs/auth.ts @@ -2,6 +2,8 @@ import { createAuthClient } from 'better-auth/vue' import { useAuthStore } from '../stores/auth' +export type OAuthProvider = 'google' | 'github' + export const SERVER_URL = import.meta.env.VITE_SERVER_URL || 'https://airi-api.moeru.ai' export const authClient = createAuthClient({ @@ -34,16 +36,9 @@ export async function signOut() { authStore.session = undefined } -export async function signIn(provider: 'google' | 'github') { - const authStore = useAuthStore() - authStore.isLoggingIn = true - try { - return await authClient.signIn.social({ - provider, - callbackURL: window.location.origin, - }) - } - finally { - authStore.isLoggingIn = false - } +export async function signIn(provider: OAuthProvider) { + return await authClient.signIn.social({ + provider, + callbackURL: window.location.origin, + }) } diff --git a/packages/stage-ui/src/stores/auth.ts b/packages/stage-ui/src/stores/auth.ts index 1db1d7ced..8e6cc7dc6 100644 --- a/packages/stage-ui/src/stores/auth.ts +++ b/packages/stage-ui/src/stores/auth.ts @@ -9,7 +9,6 @@ export const useAuthStore = defineStore('auth', () => { const isAuthenticated = computed(() => !!user.value && !!session.value) const isLoginOpen = ref(false) - const isLoggingIn = ref(false) // TODO: include fetchSession here for pulling and updating better-auth session with initialize(...) action @@ -18,6 +17,5 @@ export const useAuthStore = defineStore('auth', () => { session, isAuthenticated, isLoginOpen, - isLoggingIn, } })