Skip to content

Commit 8360c00

Browse files
committed
STCOR-1027 fix double-reading response body strean
1 parent bc68bc7 commit 8360c00

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

src/loginServices.js

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -439,16 +439,6 @@ const getTenantLocale = async (url, store, tenant) => {
439439
mode: 'cors',
440440
});
441441

442-
if (response.ok) {
443-
const locale = await response.json();
444-
445-
dispatchLocale(
446-
locale,
447-
store,
448-
tenant
449-
);
450-
}
451-
452442
return response;
453443
};
454444

@@ -474,20 +464,6 @@ const getUserOwnLocale = async (url, store, tenant, userId) => {
474464
mode: 'cors',
475465
});
476466

477-
if (response.ok) {
478-
const json = await response.json();
479-
480-
if (json.items?.length) {
481-
const localeValues = JSON.parse(json.items[0]?.value);
482-
483-
dispatchLocale(
484-
localeValues,
485-
store,
486-
tenant
487-
);
488-
}
489-
}
490-
491467
return response;
492468
};
493469

@@ -592,7 +568,7 @@ export async function loadResources(store, tenant, userId) {
592568
getTenantLocale(okapiUrl, store, tenant),
593569
getUserOwnLocale(okapiUrl, store, tenant, userId),
594570
]);
595-
const [tenantLocaleData, userLocaleData] = [responses];
571+
const [tenantLocaleData, userLocaleData] = await Promise.all(responses.map(res => res.value?.json?.()));
596572
hasSetting = tenantLocaleData || userLocaleData?.items[0].value;
597573

598574
if (hasSetting) {

0 commit comments

Comments
 (0)