feat: update @valkyr/db -> 3.0.2
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
"@tailwindcss/vite": "4.1.17",
|
||||
"@tanstack/react-router": "1.139.9",
|
||||
"@tanstack/react-table": "8.21.3",
|
||||
"@valkyr/db": "npm:@jsr/valkyr__db@3.0.1",
|
||||
"@valkyr/db": "npm:@jsr/valkyr__db@3.0.2",
|
||||
"@zitadel/react": "1.1.0",
|
||||
"class-variance-authority": "0.7.1",
|
||||
"clsx": "2.1.1",
|
||||
|
||||
@@ -82,8 +82,20 @@ export const payment = new IndexedDB({
|
||||
});
|
||||
|
||||
export async function loadBeneficiaries(): Promise<void> {
|
||||
if (hasCacheKey("beneficiaries")) {
|
||||
return; // don't re-fetch the same key
|
||||
}
|
||||
setCacheKey("beneficiaries");
|
||||
const result = await api.payment.benficiaries.list();
|
||||
if ("data" in result) {
|
||||
payment.collection("beneficiary").insert(result.data);
|
||||
}
|
||||
}
|
||||
|
||||
function hasCacheKey(key: string): boolean {
|
||||
return localStorage.getItem(key) !== null;
|
||||
}
|
||||
|
||||
function setCacheKey(key: string): void {
|
||||
localStorage.setItem(key, "cached");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user