Add stopwatch to API widget type validation and defaults
The API has its own WidgetType and normalizeWidgetType that were not updated when the stopwatch widget was added, causing 'Widget-Typ ist ungültig' on creation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import { NextRequest, NextResponse } from "next/server";
|
|||||||
import { requireCurrentUser, UnauthorizedError } from "@/lib/auth";
|
import { requireCurrentUser, UnauthorizedError } from "@/lib/auth";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
type WidgetType = "favorites" | "note" | "search" | "calendar" | "calculator" | "clock" | "domain-check";
|
type WidgetType = "favorites" | "note" | "search" | "calendar" | "calculator" | "clock" | "domain-check" | "stopwatch";
|
||||||
|
|
||||||
type ExistingWidgetBox = {
|
type ExistingWidgetBox = {
|
||||||
x: number;
|
x: number;
|
||||||
@@ -54,6 +54,11 @@ const widgetCatalog: Record<WidgetType, WidgetDefaults> = {
|
|||||||
title: "Domainprüfung",
|
title: "Domainprüfung",
|
||||||
w: 16,
|
w: 16,
|
||||||
h: 12
|
h: 12
|
||||||
|
},
|
||||||
|
stopwatch: {
|
||||||
|
title: "Stoppuhr",
|
||||||
|
w: 12,
|
||||||
|
h: 20
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -65,7 +70,8 @@ function normalizeWidgetType(value: unknown): WidgetType | null {
|
|||||||
value === "calendar" ||
|
value === "calendar" ||
|
||||||
value === "calculator" ||
|
value === "calculator" ||
|
||||||
value === "clock" ||
|
value === "clock" ||
|
||||||
value === "domain-check"
|
value === "domain-check" ||
|
||||||
|
value === "stopwatch"
|
||||||
) {
|
) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user