mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-07-02 17:00:28 +08:00
move to RoleSelect file
This commit is contained in:
@@ -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,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.
|
||||
|
||||
Reference in New Issue
Block a user