refactor: enhance web ux

This commit is contained in:
ReaJason
2025-01-18 20:00:24 +08:00
parent 70eef7faee
commit 88a26e9ba0
16 changed files with 649 additions and 480 deletions
+6 -2
View File
@@ -2,16 +2,20 @@ import * as z from "zod";
const EnvSchema = z.object({
API_URL: z.optional(z.string()),
MODE: z.string(),
});
const createEnv = () => {
// @ts-ignore
const envVars = Object.entries(import.meta.env).reduce<Record<string, string>>((acc, curr) => {
const [key, value] = curr;
if (key.startsWith("VITE_APP_")) {
if (typeof value === "string") {
if (typeof value === "string") {
if (key.startsWith("VITE_APP_")) {
acc[key.replace("VITE_APP_", "")] = value;
}
if (key === "MODE") {
acc[key] = value;
}
}
return acc;
}, {});