Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Use labels API when possible instead of Series #857

Merged
merged 11 commits into from
Jul 17, 2023
Prev Previous commit
Next Next commit
Fixes tenants tests
  • Loading branch information
cyriltovena committed Jul 17, 2023
commit f4f999db678c27d48ccdc2b312a1f0da32eea964
17 changes: 10 additions & 7 deletions public/app/overrides/services/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,16 @@ export async function connectRequest(
const data = JSON.parse(textBody);

// Check if it's 401 unauthorized error
// if (response.status === 401) {
// // TODO: Introduce some kind of interceptor (?)
// // if (!/\/(login|signup)$/.test(window?.location?.pathname)) {
// // window.location.href = mountURL('/login');
// // }
// return Result.err(new RequestNotOkError(response.status, data.error));
// }
if (response.status === 401) {
// TODO: Introduce some kind of interceptor (?)
// if (!/\/(login|signup)$/.test(window?.location?.pathname)) {
// window.location.href = mountURL('/login');
// }
if ('message' in data && typeof data.message === 'string') {
return Result.err(new RequestNotOkError(response.status, data.message));
}
return Result.err(new RequestNotOkError(response.status, data.error));
}

// Usually it's a feedback on user's actions like form validation
if ('errors' in data && Array.isArray(data.errors)) {
Expand Down
2 changes: 1 addition & 1 deletion public/app/services/tenant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function isOrgRequiredError(res: Awaited<ReturnType<typeof requestWithOrgID>>) {
res.isErr &&
res.error instanceof RequestNotOkError &&
res.error.code === 401 &&
res.error.message.includes('no org id')
res.error.description.includes('no org id')
);
}

Expand Down
Loading