diff --git a/frontend/package.json b/frontend/package.json index b3709a8..1c09322 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -82,6 +82,11 @@ }, "packageManager": "pnpm@10.4.1+sha512.c753b6c3ad7afa13af388fa6d808035a008e30ea9993f58c6663e2bc5ff21679aa834db094987129aa4d488b86df57f7b634981b2f827cdcacc698cc0cfb88af", "pnpm": { + "peerDependencyRules": { + "allowedVersions": { + "vite": "7" + } + }, "patchedDependencies": { "wouter@3.7.1": "patches/wouter@3.7.1.patch" }, diff --git a/frontend/src/const.ts b/frontend/src/const.ts index bf56212..3334c2d 100644 --- a/frontend/src/const.ts +++ b/frontend/src/const.ts @@ -5,7 +5,7 @@ export const getLoginUrl = () => { // ... existing code ... }; -export const BOUNTY_STATUS_MAP: Record = { +export const BOUNTY_STATUS_MAP: Record = { open: { label: "开放中", class: "badge-open" }, in_progress: { label: "进行中", class: "badge-in-progress" }, completed: { label: "已完成", class: "badge-completed" }, diff --git a/frontend/src/lib/api/admin.ts b/frontend/src/lib/api/admin.ts index 655e7ed..1a98e84 100644 --- a/frontend/src/lib/api/admin.ts +++ b/frontend/src/lib/api/admin.ts @@ -3,15 +3,15 @@ import type { AdminBounty, AdminPaymentEvent, AdminUser, AdminProduct, Paginated export const adminApi = { listUsers: () => api.get>("/admin/users/").then((r) => r.data), - updateUser: (id: number, data: { role?: string; is_active?: boolean }) => + updateUser: (id: number, data: { role?: string, is_active?: boolean }) => api.patch(`/admin/users/${id}`, data).then((r) => r.data), - listCategories: () => api.get>("/admin/categories/").then((r) => r.data), - listWebsites: () => api.get>("/admin/websites/").then((r) => r.data), - listProducts: () => api.get>("/admin/products/").then((r) => r.data), + listCategories: () => api.get>("/admin/categories/").then((r) => r.data), + listWebsites: () => api.get>("/admin/websites/").then((r) => r.data), + listProducts: () => api.get>("/admin/products/").then((r) => r.data), listBounties: (status?: string) => api.get>("/admin/bounties/", { params: { status } }).then((r) => r.data), listDisputes: (status?: string) => - api.get>>( + api.get>( "/admin/disputes/", { params: { status } } ).then((r) => r.data), @@ -22,6 +22,6 @@ export const adminApi = { api.get>("/admin/products/pending/").then((r) => r.data), listAllProducts: (status?: string) => api.get>("/admin/products/all/", { params: { status } }).then((r) => r.data), - reviewProduct: (productId: number, data: { approved: boolean; reject_reason?: string }) => + reviewProduct: (productId: number, data: { approved: boolean, reject_reason?: string }) => api.post(`/admin/products/${productId}/review/`, data).then((r) => r.data), }; diff --git a/frontend/src/lib/api/client.ts b/frontend/src/lib/api/client.ts index 1fac5bc..c064b81 100644 --- a/frontend/src/lib/api/client.ts +++ b/frontend/src/lib/api/client.ts @@ -71,7 +71,7 @@ async function refreshAccessToken() { } if (!refreshPromise) { refreshPromise = refreshApi - .post<{ access_token: string; refresh_token: string; token_type: string }>( + .post<{ access_token: string, refresh_token: string, token_type: string }>( "/auth/refresh", { refresh_token: token } ) diff --git a/frontend/src/lib/api/favorites.ts b/frontend/src/lib/api/favorites.ts index 78b5f5e..ac97056 100644 --- a/frontend/src/lib/api/favorites.ts +++ b/frontend/src/lib/api/favorites.ts @@ -9,16 +9,16 @@ import type { } from "../types"; export const favoriteApi = { - list: (params?: { tag_id?: number; page?: number }) => + list: (params?: { tag_id?: number, page?: number }) => api.get>("/favorites/", { params }).then((r) => r.data), exportCsv: () => api.get("/favorites/export/", { responseType: "blob" }).then((r) => r.data), get: (id: number) => api.get(`/favorites/${id}`).then((r) => r.data), check: (productId: number, websiteId: number) => - api.get<{ is_favorited: boolean; favorite_id: number | null }>( + api.get<{ is_favorited: boolean, favorite_id: number | null }>( "/favorites/check/", { params: { product_id: productId, website_id: websiteId } } ).then((r) => r.data), - add: (data: { product_id: number; website_id: number }) => + add: (data: { product_id: number, website_id: number }) => api.post("/favorites/", data).then((r) => r.data), remove: (id: number) => api.delete(`/favorites/${id}`).then((r) => r.data), diff --git a/frontend/src/lib/api/payments.ts b/frontend/src/lib/api/payments.ts index d3b52db..808d608 100644 --- a/frontend/src/lib/api/payments.ts +++ b/frontend/src/lib/api/payments.ts @@ -2,14 +2,14 @@ import { api } from "./client"; import type { MessageResponse } from "../types"; export const paymentApi = { - createEscrow: (data: { bounty_id: number; success_url: string; cancel_url: string }) => - api.post<{ checkout_url: string; session_id: string }>("/payments/escrow/", data).then((r) => r.data), + createEscrow: (data: { bounty_id: number, success_url: string, cancel_url: string }) => + api.post<{ checkout_url: string, session_id: string }>("/payments/escrow/", data).then((r) => r.data), getConnectStatus: () => - api.get<{ has_account: boolean; account_id: string | null; is_complete: boolean; dashboard_url: string | null }>( + api.get<{ has_account: boolean, account_id: string | null, is_complete: boolean, dashboard_url: string | null }>( "/payments/connect/status/" ).then((r) => r.data), setupConnectAccount: (returnUrl: string, refreshUrl: string) => - api.post<{ onboarding_url: string; account_id: string }>( + api.post<{ onboarding_url: string, account_id: string }>( "/payments/connect/setup/", null, { params: { return_url: returnUrl, refresh_url: refreshUrl } }