From 9ce3cccfd40b7d726d81ada23f269628b3dbbca2 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Tue, 15 Apr 2025 19:41:22 -0400 Subject: [PATCH] [API Nodes] Wire password login (#3469) --- src/components/dialog/content/SignInContent.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/dialog/content/SignInContent.vue b/src/components/dialog/content/SignInContent.vue index d005ffe87..d754ccbdb 100644 --- a/src/components/dialog/content/SignInContent.vue +++ b/src/components/dialog/content/SignInContent.vue @@ -80,6 +80,7 @@ import { ref } from 'vue' import { useI18n } from 'vue-i18n' import { SignInData, SignUpData } from '@/schemas/signInSchema' +import { useFirebaseAuthStore } from '@/stores/firebaseAuthStore' import SignInForm from './signin/SignInForm.vue' import SignUpForm from './signin/SignUpForm.vue' @@ -90,6 +91,8 @@ const { onSuccess } = defineProps<{ onSuccess: () => void }>() +const firebaseAuthStore = useFirebaseAuthStore() + const isSignIn = ref(true) const toggleState = () => { isSignIn.value = !isSignIn.value @@ -109,10 +112,13 @@ const signInWithGithub = () => { onSuccess() } -const signInWithEmail = (values: SignInData | SignUpData) => { - // Implement email login - console.log(isSignIn.value) - console.log(values) +const signInWithEmail = async (values: SignInData | SignUpData) => { + const { email, password } = values + if (isSignIn.value) { + await firebaseAuthStore.login(email, password) + } else { + await firebaseAuthStore.register(email, password) + } onSuccess() }