fix(admin): persist data directory and pass env vars
This commit is contained in:
parent
99e8201745
commit
1d7e7c41c9
39 changed files with 1297 additions and 32 deletions
34
components/admin/StatusSelect.tsx
Normal file
34
components/admin/StatusSelect.tsx
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import type { InquiryStatus } from "@/lib/admin/types";
|
||||
|
||||
type Props = {
|
||||
id: string;
|
||||
type: "contact" | "repair";
|
||||
status: InquiryStatus;
|
||||
};
|
||||
|
||||
export default function StatusSelect({ id, type, status }: Props) {
|
||||
const router = useRouter();
|
||||
const [value, setValue] = useState(status);
|
||||
|
||||
async function update(nextStatus: InquiryStatus) {
|
||||
setValue(nextStatus);
|
||||
const response = await fetch(`/api/admin/${type}/${id}`, {
|
||||
method: "PATCH",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ status: nextStatus }),
|
||||
});
|
||||
if (response.ok) router.refresh();
|
||||
}
|
||||
|
||||
return (
|
||||
<select className="status-select" value={value} onChange={(event) => update(event.target.value as InquiryStatus)}>
|
||||
<option value="new">Neu</option>
|
||||
<option value="in_progress">In Prüfung</option>
|
||||
<option value="done">Erledigt</option>
|
||||
</select>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue