This commit is contained in:
Atridad Lahiji 2023-11-27 18:32:31 -07:00
parent d5a53dbe35
commit fd3b1234e8
No known key found for this signature in database
3 changed files with 74 additions and 70 deletions

View file

@ -7,69 +7,71 @@ export default function FourOhFour() {
if (isRouteErrorResponse(error)) { if (isRouteErrorResponse(error)) {
return ( return (
<span className="text-center"> <span className="text-center">
<h1 className="text-5xl font-bold m-2">Error {error.status}</h1> <h1 className="text-5xl font-bold m-2">Error {error.status}</h1>
<h1 className="text-5xl font-bold m-2">{error.statusText}</h1> <h1 className="text-5xl font-bold m-2">{error.data}</h1>
<h2 className="text-2xl font-bold m-2"> <h2 className="text-2xl font-bold m-2">
If you believe you reached this page in error, please file an issue{" "} If you believe you reached this page in error, please file an issue{" "}
<a <a
href="https://github.com/atridadl/sprintpadawan/issues/new" href="https://github.com/atridadl/sprintpadawan/issues/new"
className="link link-secondary" className="link link-secondary"
>
here
</a>
</h2>
<Link
about="Back to home."
to="/"
className="btn btn-secondary normal-case text-xl m-2"
> >
here Back to Home
</a> </Link>
</h2> </span>
<Link
about="Back to home."
to="/"
className="btn btn-secondary normal-case text-xl m-2"
>
Back to Home
</Link>
</span>
); );
} else if (error instanceof Error) { } else if (error instanceof Error) {
return ( return (
<span className="text-center"> <span className="text-center">
<h1 className="text-5xl font-bold m-2">Error 500</h1> <h1 className="text-5xl font-bold m-2">Error {error.name}</h1>
<h2 className="text-2xl font-bold m-2"> <h1 className="text-3xl font-bold m-2">Error {error.message}</h1>
If you believe you reached this page in error, please file an issue{" "}
<a <h2 className="text-2xl font-bold m-2">
href="https://github.com/atridadl/sprintpadawan/issues/new" If you believe you reached this page in error, please file an issue{" "}
className="link link-secondary" <a
href="https://github.com/atridadl/sprintpadawan/issues/new"
className="link link-secondary"
>
here
</a>
</h2>
<Link
about="Back to home."
to="/"
className="btn btn-secondary normal-case text-xl m-2"
> >
here Back to Home
</a> </Link>
</h2> </span>
<Link
about="Back to home."
to="/"
className="btn btn-secondary normal-case text-xl m-2"
>
Back to Home
</Link>
</span>
); );
} else { } else {
return( return (
<span className="text-center"> <span className="text-center">
<h1 className="text-5xl font-bold m-2">Error {error.status}</h1> <h1 className="text-5xl font-bold m-2">Error 500</h1>
<h1 className="text-5xl font-bold m-2">{error.statusText}</h1> <h2 className="text-2xl font-bold m-2">
<h2 className="text-2xl font-bold m-2"> If you believe you reached this page in error, please file an issue{" "}
If you believe you reached this page in error, please file an issue{" "} <a
<a href="https://github.com/atridadl/sprintpadawan/issues/new"
href="https://github.com/atridadl/sprintpadawan/issues/new" className="link link-secondary"
className="link link-secondary" >
here
</a>
</h2>
<Link
about="Back to home."
to="/"
className="btn btn-secondary normal-case text-xl m-2"
> >
here Back to Home
</a> </Link>
</h2> </span>
<Link );
about="Back to home."
to="/"
className="btn btn-secondary normal-case text-xl m-2"
>
Back to Home
</Link>
</span>)
} }
} }

View file

@ -27,7 +27,6 @@ import { useUser } from "@clerk/remix";
import { db } from "~/services/db.server"; import { db } from "~/services/db.server";
import { rooms } from "~/services/schema"; import { rooms } from "~/services/schema";
import { eq } from "drizzle-orm"; import { eq } from "drizzle-orm";
import { shitList } from "~/services/consts.server";
import FourOhFour from "~/components/FourOhFour"; import FourOhFour from "~/components/FourOhFour";
import { isShit } from "~/services/helpers.server"; import { isShit } from "~/services/helpers.server";
@ -44,21 +43,25 @@ export const loader: LoaderFunction = async (args) => {
}); });
if (!room) { if (!room) {
throw new Response(null, { throw new Response(
status: 404, "Oops! This room does not appear to exist, or may have been deleted!",
statusText: {
"Oops! This room does not appear to exist, or may have been deleted!", status: 404,
}); statusText: "NOT FOUND",
}
);
} }
const email = sessionClaims.email as string; const email = sessionClaims.email as string;
const shit = isShit(email);
if (isShit(email)) { if (shit) {
throw new Response(null, { throw new Response(
status: 404, "Wowee zowee! I'm sure I put that room around here somewhere...",
statusText: {
"Wowee zowee! I'm sure I put that room around here somewhere...", status: 404,
}); statusText: "NOT FOUND",
}
);
} }
return {}; return {};

View file

@ -1 +0,0 @@
export const shitList = ["ama.ab.ca"];