diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-03-12 15:07:45 +0900 |
|---|---|---|
| committer | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-03-12 15:07:45 +0900 |
| commit | 8508c4dadc51fa597884655195b6fe80ca2d4e08 (patch) | |
| tree | a2268f41f150c9210d47923cc90dbe196080a336 /packages/frontend/src/preferences.ts | |
| parent | enhance(dev): frontendの検索インデックス作成を単独のコマン... (diff) | |
| download | sharkey-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.ts | 15 |
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); |