Fix redirect issue after login
This commit is contained in:
@@ -26,7 +26,6 @@
|
|||||||
// import Footer from '../components/Footer/index.svelte';
|
// import Footer from '../components/Footer/index.svelte';
|
||||||
import Apps from '../components/Apps/index.svelte';
|
import Apps from '../components/Apps/index.svelte';
|
||||||
import PlayQuiz from '../components/Org/Quiz/Play/index.svelte';
|
import PlayQuiz from '../components/Org/Quiz/Play/index.svelte';
|
||||||
import { handleAuthChange } from '../utils/functions/api';
|
|
||||||
import {
|
import {
|
||||||
isCoursesPage,
|
isCoursesPage,
|
||||||
isOrgPage,
|
isOrgPage,
|
||||||
@@ -147,10 +146,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const orgRes = await getOrganizations($profile.id);
|
const orgRes = await getOrganizations($profile.id);
|
||||||
console.log('orgRes', orgRes);
|
|
||||||
console.log('$appStore.isStudentDomain', $appStore.isStudentDomain);
|
|
||||||
console.log('isEmpty(orgRes.orgs)', isEmpty(orgRes.orgs));
|
|
||||||
console.log('path', path);
|
|
||||||
|
|
||||||
// student redirect
|
// student redirect
|
||||||
if ($appStore.isStudentDomain) {
|
if ($appStore.isStudentDomain) {
|
||||||
@@ -163,7 +158,7 @@
|
|||||||
if (isEmpty(orgRes.orgs)) {
|
if (isEmpty(orgRes.orgs)) {
|
||||||
goto(ROUTE.ONBOARDING);
|
goto(ROUTE.ONBOARDING);
|
||||||
} else if (
|
} else if (
|
||||||
['login', 'signup', 'onboarding'].includes(path) ||
|
['login', 'signup', 'onboarding'].some((r) => path.includes(r)) ||
|
||||||
path === '' // for home page
|
path === '' // for home page
|
||||||
) {
|
) {
|
||||||
// By default redirect to first organization
|
// By default redirect to first organization
|
||||||
@@ -211,9 +206,6 @@
|
|||||||
|
|
||||||
const { data: authListener } = supabase.auth.onAuthStateChange(
|
const { data: authListener } = supabase.auth.onAuthStateChange(
|
||||||
(event, session) => {
|
(event, session) => {
|
||||||
if (config.isProd) {
|
|
||||||
handleAuthChange(event, session);
|
|
||||||
}
|
|
||||||
// Log key events
|
// Log key events
|
||||||
console.log(`event`, event);
|
console.log(`event`, event);
|
||||||
if (event == 'PASSWORD_RECOVERY') {
|
if (event == 'PASSWORD_RECOVERY') {
|
||||||
|
|||||||
Reference in New Issue
Block a user