From fec1700f144609114092b16f78c4f811f5c12ffc Mon Sep 17 00:00:00 2001 From: TrainDoctor Date: Sun, 13 Oct 2024 14:42:48 -0700 Subject: [PATCH] Fix up json call --- frontend/src/store.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend/src/store.tsx b/frontend/src/store.tsx index 282b34a4..18d155be 100644 --- a/frontend/src/store.tsx +++ b/frontend/src/store.tsx @@ -109,16 +109,18 @@ export async function getPluginList( headers: { 'X-Decky-Version': version.current, }, - }).then((r) => { - let res = JSON.parse(JSON.stringify(r.json())); + }).then(async (r) => { + let res = structuredClone(await r.json()); const lng = navigator.language; - if (res.hasOwnProperty('name-' + lng)) { - res.name = res['name-' + lng]; + for (let val of res) { + if (val.hasOwnProperty('name-' + lng)) { + val.name = val['name-' + lng]; + } + if (val.hasOwnProperty('description-' + lng)) { + val.description = val['description-' + lng]; + } + return val; } - if (res.hasOwnProperty('description-' + lng)) { - res.description = res['description-' + lng]; - } - return res; }); }