Skip to content

Commit

Permalink
feat: 404 for not found subdomain
Browse files Browse the repository at this point in the history
  • Loading branch information
rotimi-best committed Dec 11, 2023
1 parent b7f9d14 commit 820a59c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
6 changes: 5 additions & 1 deletion apps/dashboard/src/routes/+layout.server.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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;
}
Expand Down
26 changes: 12 additions & 14 deletions apps/dashboard/src/routes/404/+page.svelte
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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>
Expand Down

2 comments on commit 820a59c

@vercel
Copy link

@vercel vercel bot commented on 820a59c Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

landingpage – ./apps/classroomio-com

landingpage-git-main-rotimi-best.vercel.app
classroomio-com.vercel.app
landingpage-rotimi-best.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 820a59c Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.