Files
khalijpay-issuer/src/services/generalAPI.js
2025-12-15 14:04:15 +03:30

59 lines
1.8 KiB
JavaScript

import api from './apiClient';
// -----------------------------
// General API
// -----------------------------
export const generalAPI = {
// GET /api/v1/General/Currencies
async getCurrencies() {
try {
const res = await api.get('/api/v1/General/Currencies', { skipAuthRedirect: true });
// پاسخ به صورت array مستقیم است
return Array.isArray(res?.data) ? res?.data : [];
} catch (error) {
console.error('🔴 General API - getCurrencies error:', error);
throw error;
}
},
// GET /api/v1/General/TimeZones
async getTimeZones() {
try {
const res = await api.get('/api/v1/General/TimeZones', { skipAuthRedirect: true });
// پاسخ به صورت { data: [...], statusCode: 200, ... } است
return res?.data?.data || [];
} catch (error) {
console.error('🔴 General API - getTimeZones error:', error);
throw error;
}
},
// GET /api/v1/General/IssuerCapabilities
async getIssuerCapabilities() {
try {
const res = await api.get('/api/v1/General/IssuerCapabilities', { skipAuthRedirect: true });
// پاسخ به صورت { data: [...], statusCode: 200, ... } است
return res?.data?.data || [];
} catch (error) {
console.error('🔴 General API - getIssuerCapabilities error:', error);
throw error;
}
},
// GET /api/v1/General/SearchUsersByEmail
async searchUsersByEmail(email) {
try {
const res = await api.get('/api/v1/General/SearchUsersByEmail', {
params: { email: email || '' },
skipAuthRedirect: true
});
// پاسخ به صورت { data: [...], statusCode: 200, ... } است
return res?.data?.data || [];
} catch (error) {
console.error('🔴 General API - searchUsersByEmail error:', error);
throw error;
}
},
};