chore: login/signup improvements

This commit is contained in:
Rotimi Best
2023-12-11 21:18:31 +03:00
parent bd12bcbcfc
commit bbe6e78f88
6 changed files with 13 additions and 10 deletions
+2
View File
@@ -34,3 +34,5 @@ yarn-error.log*
# vercel
.vercel
vite.config.ts*.mjs
+3 -2
View File
@@ -1,3 +1,4 @@
import { dev } from '$app/environment';
import { redirect } from '@sveltejs/kit';
import { blockedSubdomain } from '$lib/utils/constants/app';
import { getCurrentOrg } from '$lib/utils/services/org';
@@ -37,12 +38,12 @@ export const load = async ({ url, cookies }): Promise<LoadOutput> => {
response.orgSiteName = debugMode ? _orgSiteName : subdomain;
response.org = (await getCurrentOrg(response.orgSiteName, true)) || null;
if (!response.org) {
if (!response.org && !dev) {
throw redirect(301, 'https://app.classroomio.com/404?type=org');
}
} else if (subdomain === 'play' || debugPlay === 'true') {
response.skipAuth = true;
} else if (subdomain !== 'app') {
} else if (subdomain !== 'app' && !dev) {
throw redirect(301, 'https://app.classroomio.com');
}
+5 -3
View File
@@ -4,7 +4,7 @@
import { fly } from 'svelte/transition';
import { derived } from 'svelte/store';
import { goto } from '$app/navigation';
import { browser } from '$app/environment';
import { browser, dev } from '$app/environment';
import { page, navigating } from '$app/stores';
import isEmpty from 'lodash/isEmpty';
import { Theme, ToastNotification, Loading } from 'carbon-components-svelte';
@@ -56,6 +56,10 @@
// Set up posthog
initPosthog();
if (!dev) {
injectSpeedInsights();
}
}
function setAnalyticsUser() {
@@ -216,8 +220,6 @@
setupAnalytics();
injectSpeedInsights();
handleResize();
if (!isSupabaseTokenInLocalStorage() && !isPublicRoute($page.url?.pathname)) {
@@ -42,7 +42,6 @@
});
} catch (error) {
submitError = error.error_description || error.message;
} finally {
loading = false;
}
}
@@ -103,7 +103,6 @@
fields = Object.assign({}, SIGNUP_FIELDS);
} catch (error) {
submitError = error?.error_description || error?.message;
} finally {
loading = false;
}
}