Bugfix with usertype
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { UserType } from "@prisma/client";
|
||||
import type { ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";
|
||||
import { json, redirect } from "@remix-run/node";
|
||||
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." });
|
||||
}
|
||||
|
||||
const normalizedType = type === UserType.Admin || type === UserType.Scanner ? type : UserType.User;
|
||||
const normalizedType = (type === "Admin" || type === "Scanner") ? type : "User";
|
||||
|
||||
try {
|
||||
await dbe.user.create({
|
||||
@@ -201,10 +200,10 @@ export default function AdminRoute() {
|
||||
</BootstrapForm.Group>
|
||||
<BootstrapForm.Group className="mb-3">
|
||||
<BootstrapForm.Label>Role</BootstrapForm.Label>
|
||||
<BootstrapForm.Select name="type" defaultValue={UserType.User}>
|
||||
<option value={UserType.User}>User</option>
|
||||
<option value={UserType.Scanner}>Scanner</option>
|
||||
<option value={UserType.Admin}>Admin</option>
|
||||
<BootstrapForm.Select name="type" defaultValue="User">
|
||||
<option value="User">User</option>
|
||||
<option value="Scanner">Scanner</option>
|
||||
<option value="Admin">Admin</option>
|
||||
</BootstrapForm.Select>
|
||||
</BootstrapForm.Group>
|
||||
<Button type="submit">Create user</Button>
|
||||
|
||||
Reference in New Issue
Block a user