haha
This commit is contained in:
@@ -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"
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ export const getLoginUrl = () => {
|
||||
// ... existing code ...
|
||||
};
|
||||
|
||||
export const BOUNTY_STATUS_MAP: Record<string, { label: string; class: string }> = {
|
||||
export const BOUNTY_STATUS_MAP: Record<string, { label: string, class: string }> = {
|
||||
open: { label: "开放中", class: "badge-open" },
|
||||
in_progress: { label: "进行中", class: "badge-in-progress" },
|
||||
completed: { label: "已完成", class: "badge-completed" },
|
||||
|
||||
@@ -3,15 +3,15 @@ import type { AdminBounty, AdminPaymentEvent, AdminUser, AdminProduct, Paginated
|
||||
|
||||
export const adminApi = {
|
||||
listUsers: () => api.get<PaginatedResponse<AdminUser>>("/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<AdminUser>(`/admin/users/${id}`, data).then((r) => r.data),
|
||||
listCategories: () => api.get<PaginatedResponse<{ id: number; name: string }>>("/admin/categories/").then((r) => r.data),
|
||||
listWebsites: () => api.get<PaginatedResponse<{ id: number; name: string }>>("/admin/websites/").then((r) => r.data),
|
||||
listProducts: () => api.get<PaginatedResponse<{ id: number; name: string }>>("/admin/products/").then((r) => r.data),
|
||||
listCategories: () => api.get<PaginatedResponse<{ id: number, name: string }>>("/admin/categories/").then((r) => r.data),
|
||||
listWebsites: () => api.get<PaginatedResponse<{ id: number, name: string }>>("/admin/websites/").then((r) => r.data),
|
||||
listProducts: () => api.get<PaginatedResponse<{ id: number, name: string }>>("/admin/products/").then((r) => r.data),
|
||||
listBounties: (status?: string) =>
|
||||
api.get<PaginatedResponse<AdminBounty>>("/admin/bounties/", { params: { status } }).then((r) => r.data),
|
||||
listDisputes: (status?: string) =>
|
||||
api.get<PaginatedResponse<{ id: number; bounty_id: number; initiator_id: number; status: string; created_at: string }>>>(
|
||||
api.get<PaginatedResponse<{ id: number, bounty_id: number, initiator_id: number, status: string, created_at: string }>>(
|
||||
"/admin/disputes/",
|
||||
{ params: { status } }
|
||||
).then((r) => r.data),
|
||||
@@ -22,6 +22,6 @@ export const adminApi = {
|
||||
api.get<PaginatedResponse<AdminProduct>>("/admin/products/pending/").then((r) => r.data),
|
||||
listAllProducts: (status?: string) =>
|
||||
api.get<PaginatedResponse<AdminProduct>>("/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<AdminProduct>(`/admin/products/${productId}/review/`, data).then((r) => r.data),
|
||||
};
|
||||
|
||||
@@ -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 }
|
||||
)
|
||||
|
||||
@@ -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<PaginatedResponse<Favorite>>("/favorites/", { params }).then((r) => r.data),
|
||||
exportCsv: () => api.get<Blob>("/favorites/export/", { responseType: "blob" }).then((r) => r.data),
|
||||
get: (id: number) => api.get<Favorite>(`/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<Favorite>("/favorites/", data).then((r) => r.data),
|
||||
remove: (id: number) => api.delete<MessageResponse>(`/favorites/${id}`).then((r) => r.data),
|
||||
|
||||
|
||||
@@ -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 } }
|
||||
|
||||
Reference in New Issue
Block a user