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
@@ -59,8 +59,10 @@
}
onMount(() => {
if (localStorage.getItem('hideCourseNav')) {
show = localStorage.getItem('hideCourseNav') === 'false';
if (browser) {
if (localStorage.getItem('hideCourseNav')) {
show = localStorage.getItem('hideCourseNav') === 'false';
}
} else {
show = true;
}
+6 -7
View File
@@ -1,5 +1,6 @@
<script>
import { page } from '$app/stores';
import { browser } from '$app/environment';
import NotificationIcon from 'carbon-icons-svelte/lib/Notification.svelte';
import Moon from 'carbon-icons-svelte/lib/Moon.svelte';
import Sun from 'carbon-icons-svelte/lib/Sun.svelte';
@@ -14,19 +15,17 @@
$appStore.isDark = !$appStore.isDark;
toggleBodyByTheme($appStore.isDark);
localStorage.setItem('theme', $appStore.isDark ? 'dark' : '');
if (browser) {
localStorage.setItem('theme', $appStore.isDark ? 'dark' : '');
}
}
</script>
<nav class="{navClass} flex w-full p-2 md:px-6 bg-blue-600">
<ul class="flex w-full items-center">
<div class="">
<a
href={$page.url.pathname}
title="Go to ClassroomIO Home"
id="logo"
class="text-lg"
>
<a href={$page.url.pathname} title="Go to ClassroomIO Home" id="logo" class="text-lg">
ClassroomIO
</a>
</div>
+5 -7
View File
@@ -1,5 +1,6 @@
<script>
import { page } from '$app/stores';
import { browser } from '$app/environment';
import NotificationIcon from 'carbon-icons-svelte/lib/Notification.svelte';
import MoonIcon from 'carbon-icons-svelte/lib/Moon.svelte';
import SunIcon from 'carbon-icons-svelte/lib/Sun.svelte';
@@ -14,19 +15,16 @@
$appStore.isDark = !$appStore.isDark;
toggleBodyByTheme($appStore.isDark);
localStorage.setItem('theme', $appStore.isDark ? 'dark' : '');
if (browser) {
localStorage.setItem('theme', $appStore.isDark ? 'dark' : '');
}
}
</script>
<nav class="{navClass} flex w-full p-2 md:px-6 bg-blue-600">
<ul class="flex w-full items-center">
<div class="">
<a
href={$page.url.pathname}
title="Go to ClassroomIO Home"
id="logo"
class="text-lg"
>
<a href={$page.url.pathname} title="Go to ClassroomIO Home" id="logo" class="text-lg">
ClassroomIO
</a>
</div>
+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);