Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

staff yup => zod

Manav Rathi7c3a137723bc
diff --git a/web/apps/staff/package.json b/web/apps/staff/package.json
index a4752a1e76..530f7f8243 100644
--- a/web/apps/staff/package.json
+++ b/web/apps/staff/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"react": "^18",
"react-dom": "^18",
- "yup": "^1.4"
+ "zod": "^3"
},
"devDependencies": {
"@/build-config": "*",
diff --git a/web/apps/staff/src/services/support-service.ts b/web/apps/staff/src/services/support-service.ts
index 0b27260e3f..3e22234e76 100644
--- a/web/apps/staff/src/services/support-service.ts
+++ b/web/apps/staff/src/services/support-service.ts
@@ -1,10 +1,10 @@
-import { object, type InferType } from "yup";
+import { z } from "zod";
const apiOrigin = import.meta.env.VITE_ENTE_ENDPOINT ?? "https://api.ente.io";
-const userDetailsSchema = object({});
+const UserDetails = z.object({}).passthrough();
-export type UserDetails = InferType<typeof userDetailsSchema>;
+export type UserDetails = z.infer<typeof UserDetails>;
/** Fetch details of the user associated with the given {@link authToken}. */
export const getUserDetails = async (
@@ -17,5 +17,5 @@ export const getUserDetails = async (
},
});
if (!res.ok) throw new Error(`Failed to fetch ${url}: HTTP ${res.status}`);
- return await userDetailsSchema.validate(await res.json());
+ return UserDetails.parse(await res.json());
};