feat: 404 for not found subdomain

This commit is contained in:
Rotimi Best
2023-12-11 03:27:13 +03:00
parent b7f9d145de
commit 820a59c80e
2 changed files with 17 additions and 15 deletions
+5 -1
View File
@@ -1,4 +1,4 @@
// import { redirect } from '@sveltejs/kit';
import { redirect } from '@sveltejs/kit';
import { blockedSubdomain } from '$lib/utils/constants/app';
import { getCurrentOrg } from '$lib/utils/services/org';
import { getSupabase, supabase } from '$lib/utils/functions/supabase';
@@ -36,6 +36,10 @@ export const load = async ({ url, cookies }): Promise<LoadOutput> => {
response.isOrgSite = debugMode || answer;
response.orgSiteName = debugMode ? _orgSiteName : subdomain;
response.org = (await getCurrentOrg(response.orgSiteName, true)) || null;
if (!response.org) {
throw redirect(302, '/404?type=org');
}
} else if (subdomain === 'play' || debugPlay === 'true') {
response.skipAuth = true;
}
+12 -14
View File
@@ -1,10 +1,13 @@
<script>
import { page } from '$app/stores';
import { goto } from '$app/navigation';
import { appStore } from '$lib/utils/store/app';
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
const src = './bg-404.png';
let query = new URLSearchParams($page.url.search);
let isOrg = query.get('type') === 'org';
</script>
<div
@@ -13,26 +16,21 @@
>
<div class=" dark:text-white gap-3 w-4/5 lg:w-2/5">
<p class="text-3xl dark:text-white font-semibold mb-5">
Oops😕,where did the page go?
{#if isOrg}
Oops😕, this organization doesn't exist!
{:else}
Oops😕,where did the page go?
{/if}
</p>
<p class="text-base text-gray-600 dark:text-white mb-5">
We're sorry, but something went wrong and we can't show you the page
you're looking for. In the meantime, here's a joke to make you laugh:<br
/>
We're sorry, but something went wrong and we can't show you the page you're looking for. In
the meantime, here's a joke to make you laugh:<br />
What do you call a fish with no eyes? Fsh!
</p>
<PrimaryButton
label="Go to Home"
className="rounded-md"
onClick={() => goto('/')}
/>
<PrimaryButton label="Go to Home" className="rounded-md" onClick={() => goto('/')} />
</div>
<img
src="/classroom-404.png"
alt="classroomio_error_image"
class="errorImg"
/>
<img src="/classroom-404.png" alt="classroomio_error_image" class="errorImg" />
</div>
<style>