mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-23 15:26:31 +00:00
461be2afca
* initial UI for currency selection * add task to purge invitation tokens * group API contracts * fix type import * use auth middleware * add currency setting support (UI) * use group settings for format currency * fix casing
21 lines
396 B
TypeScript
21 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);
|
|
}
|