This commit is contained in:
syuilo
2025-03-12 15:07:45 +09:00
parent e594fb0037
commit 8508c4dadc
2 changed files with 38 additions and 19 deletions

View File

@@ -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);