mirror of
https://github.com/hay-kot/homebox.git
synced 2024-11-25 10:05:43 +00:00
22 lines
396 B
TypeScript
22 lines
396 B
TypeScript
|
const cache = {
|
||
|
currency: "",
|
||
|
};
|
||
|
|
||
|
export function ResetCurrency() {
|
||
|
cache.currency = "";
|
||
|
}
|
||
|
|
||
|
export async function useFormatCurrency() {
|
||
|
if (!cache.currency) {
|
||
|
const client = useUserApi();
|
||
|
|
||
|
const { data: group } = await client.group.get();
|
||
|
|
||
|
if (group) {
|
||
|
cache.currency = group.currency;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return (value: number | string) => fmtCurrency(value, cache.currency);
|
||
|
}
|