add email login

This commit is contained in:
Emily
2024-10-10 15:49:55 +02:00
parent 0a7f2b58d0
commit 80e3b0caa9
14 changed files with 531 additions and 27 deletions

View File

@@ -7,13 +7,22 @@ const route = useRoute();
const { project, projectList, projectId } = useProject();
const justLogged = computed(() => route.query.just_logged);
const jwtLogin = computed(() => route.query.jwt_login as string);
onMounted(() => {
if (justLogged.value) {
setTimeout(() => {
location.href = '/'
}, 500)
const { token, setToken } = useAccessToken();
onMounted(async () => {
if (jwtLogin.value) {
setToken(jwtLogin.value);
const user = await $fetch<any>('/api/user/me', { headers: { 'Authorization': 'Bearer ' + token.value } })
const loggedUser = useLoggedUser();
loggedUser.user = user;
// setTimeout(() => { location.reload(); }, 100);
}
if (justLogged.value) { setTimeout(() => { location.href = '/' }, 500) }
})
const firstInteraction = useFetch<boolean>('/api/project/first_interaction', {