mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-10-02 16:20:36 -05:00
User generatable API tokens (#2621)
This commit is contained in:
@@ -159,6 +159,14 @@ export const action = async ({ request }: ActionFunctionArgs) => {
|
||||
message = "Friend code updated";
|
||||
break;
|
||||
}
|
||||
case "API_ACCESS": {
|
||||
requireRole(user, "ADMIN");
|
||||
|
||||
await AdminRepository.makeApiAccesserByUserId(data.user);
|
||||
|
||||
message = "API access granted";
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
assertUnreachable(data);
|
||||
}
|
||||
@@ -217,4 +225,8 @@ export const adminActionSchema = z.union([
|
||||
friendCode,
|
||||
user: z.preprocess(actualNumber, z.number().positive()),
|
||||
}),
|
||||
z.object({
|
||||
_action: _action("API_ACCESS"),
|
||||
user: z.preprocess(actualNumber, z.number().positive()),
|
||||
}),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user