From d067551d37e6f7f3fa0cf94d3260a0fe5d3cd062 Mon Sep 17 00:00:00 2001 From: safavimohadeseh78 Date: Mon, 5 Oct 2026 17:31:27 +0330 Subject: [PATCH] fix(accounting): use useAxios in Shayegan API client Match zarin/tahesab HTTP helper so Vite can resolve the module. Co-authored-by: Cursor --- src/api/shayegan.ts | 50 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/src/api/shayegan.ts b/src/api/shayegan.ts index c6cb737..2c206f0 100644 --- a/src/api/shayegan.ts +++ b/src/api/shayegan.ts @@ -1,17 +1,43 @@ -import request from '@/utils/http' +import useAxios from '@core/utils/useAxios' -export function shayeganHealth() { - return request.get({ url: '/admin/shayegan/health' }) +export interface ShayeganRecord { + id?: number | null + customer_id?: number | null + order_id?: number | null + withdraw_id?: number | null + amount?: number | null + desc?: string | null + type?: string | null + sync_status?: 'pending' | 'success' | 'failed' | 'timeout' | string + sync_log?: string | null + shayegan_number?: string | null + shayegan_guid?: string | null + endpoint?: string | null + created_at?: string | null } -export function shayeganTable(data: Record) { - return request.post({ url: '/admin/shayegan/table', data }) -} +export const shayeganHealth = async () => + await useAxios.get<{ + ok: boolean + message?: string + http_status?: number | null + timeout?: boolean + body?: unknown + }>('/admin/shayegan/health') -export function shayeganShow(id: number | string) { - return request.get({ url: `/admin/shayegan/${id}` }) -} +export const shayeganTable = async (params: Record) => + await useAxios.post<{ + data: ShayeganRecord[] + total: number + current_page?: number + per_page?: number + }>('/admin/shayegan/table', params) -export function shayeganRetry(id: number | string, force = false) { - return request.post({ url: `/admin/shayegan/${id}/retry`, data: { force } }) -} +export const shayeganShow = async (id: number | string) => + await useAxios.get(`/admin/shayegan/${id}`) + +export const shayeganRetry = async (id: number | string, force = false) => + await useAxios.post<{ ok: boolean; message?: string; row?: ShayeganRecord }>( + `/admin/shayegan/${id}/retry`, + { force } + )