Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Frontend code editors #358

Closed
wants to merge 16 commits into from
Prev Previous commit
Next Next commit
cleaned up code in onMounted in HomeView
henrychoy committed Nov 9, 2023
commit e49141649bb0c531534b65144fdc1e1d906a1013
1 change: 0 additions & 1 deletion flask-frontend/src/layouts/NavBar.vue
Original file line number Diff line number Diff line change
@@ -82,7 +82,6 @@
formState.value = 'login';
pauseLoginCheck.value = true;
router.push('/');
console.log('loggedInUser.value from navBar = ', loggedInUser.value);
Notify.create({
color: 'green-7',
textColor: 'white',
32 changes: 15 additions & 17 deletions flask-frontend/src/views/HomeView.vue
Original file line number Diff line number Diff line change
@@ -32,24 +32,22 @@
})

onMounted(async () => {
if (!pauseLoginCheck.value) {
// login status should be checked every time page loads, but when checking immediately
// after logging out via other page, endpoint can be wrong, so in those cases dont check
try {
const res = await api.getLoginStatus()
loggedInUser.value = res.data.name;
formState.value = 'loggedIn';
} catch(err) {
loggedInUser.value = '';
formState.value = 'login';
} finally {
$q.loading.hide();
console.log('loggedInUser = ', loggedInUser.value)
console.log('formState = ', formState.value)
}
} else {
$q.loading.hide();
// login status should be checked every time page loads, but when checking immediately
// after logging out via other page, endpoint can be wrong, so in those cases dont check
if (pauseLoginCheck.value) {
pauseLoginCheck.value = false;
$q.loading.hide();
return;
};
try {
const res = await api.getLoginStatus()
loggedInUser.value = res.data.name;
formState.value = 'loggedIn';
} catch(err) {
loggedInUser.value = '';
formState.value = 'login';
} finally {
$q.loading.hide();
}
})