Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
734c52c898 |
@@ -1,4 +1,3 @@
|
|||||||
import { UserType } from "@prisma/client";
|
|
||||||
import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";
|
import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";
|
||||||
import { json, redirect } from "@remix-run/node";
|
import { json, redirect } from "@remix-run/node";
|
||||||
import { Form, Link, useActionData, useLoaderData } from "@remix-run/react";
|
import { Form, Link, useActionData, useLoaderData } from "@remix-run/react";
|
||||||
@@ -82,7 +81,7 @@ export async function action({ request }: ActionFunctionArgs) {
|
|||||||
return json({ error: "Username and password are required." });
|
return json({ error: "Username and password are required." });
|
||||||
}
|
}
|
||||||
|
|
||||||
const normalizedType = type === UserType.Admin || type === UserType.Scanner ? type : UserType.User;
|
const normalizedType = (type === "Admin" || type === "Scanner") ? type : "User";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await dbe.user.create({
|
await dbe.user.create({
|
||||||
@@ -201,10 +200,10 @@ export default function AdminRoute() {
|
|||||||
</BootstrapForm.Group>
|
</BootstrapForm.Group>
|
||||||
<BootstrapForm.Group className="mb-3">
|
<BootstrapForm.Group className="mb-3">
|
||||||
<BootstrapForm.Label>Role</BootstrapForm.Label>
|
<BootstrapForm.Label>Role</BootstrapForm.Label>
|
||||||
<BootstrapForm.Select name="type" defaultValue={UserType.User}>
|
<BootstrapForm.Select name="type" defaultValue="User">
|
||||||
<option value={UserType.User}>User</option>
|
<option value="User">User</option>
|
||||||
<option value={UserType.Scanner}>Scanner</option>
|
<option value="Scanner">Scanner</option>
|
||||||
<option value={UserType.Admin}>Admin</option>
|
<option value="Admin">Admin</option>
|
||||||
</BootstrapForm.Select>
|
</BootstrapForm.Select>
|
||||||
</BootstrapForm.Group>
|
</BootstrapForm.Group>
|
||||||
<Button type="submit">Create user</Button>
|
<Button type="submit">Create user</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user