Bugfix with usertype
Build dev docker image / release (push) Successful in 1s
Build dev docker image / build (push) Successful in 36s

This commit is contained in:
2026-08-01 12:04:21 +02:00
parent e4c93eb024
commit 734c52c898
+5 -6
View File
@@ -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>