summaryrefslogtreecommitdiff
path: root/packages/frontend/src/preferences.ts
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-03-12 15:07:45 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-03-12 15:07:45 +0900
commit8508c4dadc51fa597884655195b6fe80ca2d4e08 (patch)
treea2268f41f150c9210d47923cc90dbe196080a336 /packages/frontend/src/preferences.ts
parentenhance(dev): frontendの検索インデックス作成を単独のコマン... (diff)
downloadsharkey-8508c4dadc51fa597884655195b6fe80ca2d4e08.tar.gz
sharkey-8508c4dadc51fa597884655195b6fe80ca2d4e08.tar.bz2
sharkey-8508c4dadc51fa597884655195b6fe80ca2d4e08.zip
refactor
Diffstat (limited to 'packages/frontend/src/preferences.ts')
-rw-r--r--packages/frontend/src/preferences.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/frontend/src/preferences.ts b/packages/frontend/src/preferences.ts
index 27c61349a4..bfcd8b8dd7 100644
--- a/packages/frontend/src/preferences.ts
+++ b/packages/frontend/src/preferences.ts
@@ -87,6 +87,21 @@ const storageProvider: StorageProvider = {
value: cloudData,
});
},
+
+ cloudGets: async (ctx) => {
+ // TODO: 値の取得を1つのリクエストで済ませたい(バックエンド側でAPIの新設が必要)
+ const fetchings = ctx.needs.map(need => storageProvider.cloudGet(need).then(res => [need.key, res] as const));
+ const cloudDatas = await Promise.all(fetchings);
+
+ const res = {} as Partial<Record<string, any>>;
+ for (const cloudData of cloudDatas) {
+ if (cloudData[1] != null) {
+ res[cloudData[0]] = cloudData[1].value;
+ }
+ }
+
+ return res;
+ },
};
export const prefer = createProfileManager(storageProvider);