mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-13 14:46:10 -05:00
Move authentication logic
This commit is contained in:
@@ -14,13 +14,13 @@ import {
|
||||
Scripts,
|
||||
ScrollRestoration,
|
||||
} from "@remix-run/react";
|
||||
import { authenticator } from "~/core/authenticator.server";
|
||||
import { authenticator } from "~/core/auth/authenticator.server";
|
||||
import globalStyles from "~/styles/global.css";
|
||||
import layoutStyles from "~/styles/layout.css";
|
||||
import resetStyles from "~/styles/reset.css";
|
||||
import commonStyles from "~/styles/common.css";
|
||||
import { Layout } from "./components/layout";
|
||||
import type { LoggedInUser } from "./core/DiscordStrategy.server";
|
||||
import type { LoggedInUser } from "~/core/auth/DiscordStrategy.server";
|
||||
|
||||
export const unstable_shouldReload: ShouldReloadFunction = () => false;
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { authenticator, DISCORD_AUTH_KEY } from "~/core/authenticator.server";
|
||||
import {
|
||||
authenticator,
|
||||
DISCORD_AUTH_KEY,
|
||||
} from "~/core/auth/authenticator.server";
|
||||
import type { LoaderFunction } from "@remix-run/node";
|
||||
import { redirect } from "@remix-run/node";
|
||||
import { userPage } from "~/utils/urls";
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { authenticator, DISCORD_AUTH_KEY } from "~/core/authenticator.server";
|
||||
import {
|
||||
authenticator,
|
||||
DISCORD_AUTH_KEY,
|
||||
} from "~/core/auth/authenticator.server";
|
||||
import type { ActionFunction } from "@remix-run/node";
|
||||
|
||||
export const action: ActionFunction = async ({ request }) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ActionFunction } from "@remix-run/node";
|
||||
import { authenticator } from "~/core/authenticator.server";
|
||||
import { authenticator } from "~/core/auth/authenticator.server";
|
||||
|
||||
export const action: ActionFunction = async ({ request }) => {
|
||||
await authenticator.logout(request, { redirectTo: "/" });
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { authenticator } from "~/core/authenticator.server";
|
||||
import { authenticator } from "~/core/auth/authenticator.server";
|
||||
|
||||
export function notFoundIfFalsy<T>(value: T | null | undefined): T {
|
||||
if (!value) throw new Response(null, { status: 404 });
|
||||
|
||||
Reference in New Issue
Block a user