move to RoleSelect file

This commit is contained in:
notmd
2023-01-16 12:31:05 +07:00
parent eec432758b
commit f181094fbf
2 changed files with 5 additions and 5 deletions
+4 -1
View File
@@ -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<typeof roles>;
type RoleSelectProps = Omit<SelectProps, "defaultValue"> & {
defaultValue?: Role;
+1 -4
View File
@@ -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<typeof roles>;
/**
* 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.