Fix issue with edge function

This commit is contained in:
Rotimi Best
2023-08-03 19:31:59 +01:00
parent 22e593c114
commit fc6c7ddb71
4 changed files with 22 additions and 21 deletions
+7 -5
View File
@@ -2,7 +2,7 @@
import { onMount } from 'svelte';
import { derived } from 'svelte/store';
import { goto } from '$app/navigation';
import { dev } from '$app/environment';
import { dev, browser } from '$app/environment';
import { page, navigating } from '$app/stores';
import isEmpty from 'lodash/isEmpty';
import * as Sentry from '@sentry/browser';
@@ -171,7 +171,7 @@
}
function setOrgBasedOnUrl(host) {
if (typeof window !== 'undefined') {
if (browser) {
const debug = localStorage.getItem('role') === 'student';
const matches = host.match(/([a-z0-9]+).*classroomio[.]com/);
const subdomain = matches?.[1] ?? '';
@@ -243,9 +243,11 @@
}
});
// Update theme - dark or light mode
$appStore.isDark = localStorage.getItem('theme') === 'dark';
toggleBodyByTheme($appStore.isDark);
if (browser) {
// Update theme - dark or light mode
$appStore.isDark = localStorage.getItem('theme') === 'dark';
toggleBodyByTheme($appStore.isDark);
}
if ($appStore.isStudentDomain) {
getCurrentOrg($appStore.siteNameFromDomain);