refactor(web): use derived instead of get(t) (#10884)

This commit is contained in:
Michel Heusschen
2024-07-05 15:06:35 +02:00
committed by GitHub
parent 6791af8c2c
commit 3cd187dced
6 changed files with 16 additions and 18 deletions

View File

@@ -317,10 +317,9 @@ export const handlePromiseError = <T>(promise: Promise<T>): void => {
promise.catch((error) => console.error(`[utils.ts]:handlePromiseError ${error}`, error));
};
export const memoryLaneTitle = (yearsAgo: number) => {
const $t = get(t);
return $t('years_ago', { values: { years: yearsAgo } });
};
export const memoryLaneTitle = derived(t, ($t) => {
return (yearsAgo: number) => $t('years_ago', { values: { years: yearsAgo } });
});
export const withError = async <T>(fn: () => Promise<T>): Promise<[undefined, T] | [unknown, undefined]> => {
try {