fixes default language after signup

This commit is contained in:
Christian Beutel
2025-01-20 18:26:04 +01:00
parent 9d8a8e2ebb
commit ad5f95fcbf
4 changed files with 45 additions and 14 deletions

View File

@@ -1,10 +1,10 @@
import { z, ZodType } from "zod";
import { NotificationType } from "../notification";
import type { Settings } from "../settings";
import { Language, type Settings } from "../settings";
const SettingsCreateSchema = z.object({
unit: z.enum(["metric", "imperial"]).optional(),
language: z.enum(["en", "de", "es", "fr", "hu", "it", "nl", "pl", "pt", "zh"]).optional(),
language: z.enum(Object.values(Language) as [Language, ...Language[]]).optional(),
bio: z.string().optional(),
mapFocus: z.enum(["trails", "location"]).optional(),
location: z.object({

View File

@@ -1,9 +1,22 @@
import type { NotificationType } from "./notification";
export enum Language {
en = "en",
de = "de",
es = "es",
fr = "fr",
hu = "hu",
it = "it",
nl = "nl",
pl = "pl",
pt = "pt",
zh = "zh"
}
class Settings {
id?: string;
unit?: "metric" | "imperial";
language?: "en" | "de" | "es" | "fr" | "hu" | "it" | "nl" | "pl" | "pt" | "zh";
language?: Language;
bio?: string;
mapFocus?: "trails" | "location";
location?: { name: string, lat: number, lon: number };
@@ -16,7 +29,7 @@ class Settings {
constructor(
unit: "metric" | "imperial",
language: "en" | "de" | "es" | "fr" | "hu" | "it" | "nl" | "pl" | "pt" | "zh",
language: Language,
mapFocus: "trails" | "location",
user: string,
params?: {