Assist_Design/apps/portal/src/lib/services/currency.service.ts

17 lines
631 B
TypeScript
Raw Normal View History

import { apiClient, getDataOrThrow } from "@/lib/api";
import { FALLBACK_CURRENCY, type WhmcsCurrency } from "@customer-portal/domain/billing";
export { FALLBACK_CURRENCY };
export const currencyService = {
async getDefaultCurrency(): Promise<WhmcsCurrency> {
const response = await apiClient.GET<WhmcsCurrency>("/api/currency/default");
return getDataOrThrow(response, "Failed to get default currency");
},
async getAllCurrencies(): Promise<WhmcsCurrency[]> {
const response = await apiClient.GET<WhmcsCurrency[]>("/api/currency/all");
return getDataOrThrow(response, "Failed to get currencies");
},
};