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

17 lines
606 B
TypeScript
Raw Normal View History

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