2025-11-05 15:47:06 +09:00
|
|
|
import { apiClient, getDataOrThrow } from "@/lib/api";
|
2025-12-26 14:53:03 +09:00
|
|
|
import { FALLBACK_CURRENCY, type Currency } from "@customer-portal/domain/billing";
|
2025-10-20 13:53:35 +09:00
|
|
|
|
2025-11-17 10:31:33 +09:00
|
|
|
export { FALLBACK_CURRENCY };
|
2025-10-20 13:53:35 +09:00
|
|
|
|
2025-11-05 15:47:06 +09:00
|
|
|
export const currencyService = {
|
2025-12-26 14:53:03 +09:00
|
|
|
async getDefaultCurrency(): Promise<Currency> {
|
|
|
|
|
const response = await apiClient.GET<Currency>("/api/currency/default");
|
2025-11-05 15:47:06 +09:00
|
|
|
return getDataOrThrow(response, "Failed to get default currency");
|
|
|
|
|
},
|
2025-10-20 13:53:35 +09:00
|
|
|
|
2025-12-26 14:53:03 +09:00
|
|
|
async getAllCurrencies(): Promise<Currency[]> {
|
|
|
|
|
const response = await apiClient.GET<Currency[]>("/api/currency/all");
|
2025-11-05 15:47:06 +09:00
|
|
|
return getDataOrThrow(response, "Failed to get currencies");
|
|
|
|
|
},
|
|
|
|
|
};
|