Added beginning of login functionality
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import { ref, nextTick, onMounted, onUnmounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { eventBus } from '@/common/eventBus'
|
||||
import { authenticateParent, isParentAuthenticated, logout } from '../stores/auth'
|
||||
import { authenticateParent, isParentAuthenticated, logoutParent } from '../stores/auth'
|
||||
|
||||
const router = useRouter()
|
||||
const show = ref(false)
|
||||
@@ -42,7 +42,7 @@ const submit = () => {
|
||||
}
|
||||
|
||||
const handleLogout = () => {
|
||||
logout()
|
||||
logoutParent()
|
||||
router.push('/child')
|
||||
}
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@ import {
|
||||
ALREADY_VERIFIED,
|
||||
} from '@/common/errorCodes'
|
||||
import { parseErrorResponse, isEmailValid } from '@/common/api'
|
||||
import { loginUser } from '@/stores/auth' // <-- add this import
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
@@ -185,6 +186,8 @@ async function submitForm() {
|
||||
return
|
||||
}
|
||||
|
||||
loginUser() // <-- set user as logged in
|
||||
|
||||
await router.push({ path: '/' }).catch(() => (window.location.href = '/'))
|
||||
} catch (err) {
|
||||
loginError.value = 'Network error. Please try again.'
|
||||
|
||||
Reference in New Issue
Block a user