add: add get-user-orders-all-pairs endpoint method

This commit is contained in:
Andrew Besedin 2026-02-17 00:24:13 +03:00
parent 4d33a83ced
commit c0e6fa9308
2 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,18 @@
export type GetUserOrdersAllPairsResPair = {
id: number;
firstCurrency: {
id: number;
ticker: string | null;
};
secondCurrency: {
id: number;
ticker: string | null;
};
};
type GetUserOrdersAllPairsRes = {
success: true;
data: GetUserOrdersAllPairsResPair[];
};
export default GetUserOrdersAllPairsRes;

View file

@ -26,6 +26,7 @@ import GetPairsPagesAmountRes from '@/interfaces/responses/dex/GetPairsPagesAmou
import { PairSortOption } from '@/interfaces/enum/pair';
import { API_URL } from '@/constants';
import { GetUserOrdersData } from '@/interfaces/fetch-data/get-user-orders/GetUserOrdersData';
import GetUserOrdersAllPairsRes from '@/interfaces/responses/orders/GetUserOrdersAllPairsRes';
const isServer = typeof window === 'undefined';
const baseUrl = isServer ? API_URL : '';
@ -272,6 +273,14 @@ export async function getUserOrders({
.then((res) => res.data);
}
export async function getUserOrdersAllPairs(): Promise<ErrorRes | GetUserOrdersAllPairsRes> {
return axios
.patch('/api/orders/get-user-orders-pairs', {
token: sessionStorage.getItem('token'),
})
.then((res) => res.data);
}
export async function cancelOrder(id: string): Promise<ErrorRes | { success: true }> {
return axios
.post('/api/orders/cancel', {