From f181094fbf31e07b4b6800f5ba0dba0d083f4111 Mon Sep 17 00:00:00 2001 From: notmd Date: Mon, 16 Jan 2023 12:31:05 +0700 Subject: [PATCH] move to `RoleSelect` file --- website/src/components/RoleSelect.tsx | 5 ++++- website/src/lib/auth.ts | 5 +---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/website/src/components/RoleSelect.tsx b/website/src/components/RoleSelect.tsx index 23444b8a..d39d3868 100644 --- a/website/src/components/RoleSelect.tsx +++ b/website/src/components/RoleSelect.tsx @@ -1,6 +1,9 @@ import { Select, SelectProps } from "@chakra-ui/react"; import { forwardRef } from "react"; -import { Role, roles } from "src/lib/auth"; +import { ElementOf } from "src/types/utils"; + +export const roles = ["general", "admin", "banned"] as const; +export type Role = ElementOf; type RoleSelectProps = Omit & { defaultValue?: Role; diff --git a/website/src/lib/auth.ts b/website/src/lib/auth.ts index c749a20e..42c6cf79 100644 --- a/website/src/lib/auth.ts +++ b/website/src/lib/auth.ts @@ -1,10 +1,7 @@ import type { NextApiRequest, NextApiResponse } from "next"; import { getToken, JWT } from "next-auth/jwt"; -import { ElementOf } from "src/types/utils"; +import { Role } from "src/components/RoleSelect"; -export const roles = ["general", "admin", "banned"] as const; - -export type Role = ElementOf; /** * Wraps any API Route handler and verifies that the user does not have the * specified role. Returns a 403 if they do, otherwise runs the handler.