Skip to content

Commit

Permalink
ADM-1009 [frontend]: fix the 4xx error
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou-yinyuan committed Sep 18, 2024
1 parent 2a79f8c commit 53cdc50
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion frontend/src/hooks/useGetMetricsStepsEffect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ export const useGetMetricsStepsEffect = (): useGetMetricsStepsEffectInterface =>
setStepFailedStatus(MetricsDataFailStatus.NotFailed);
} else if (hasRejected && hasFulfilled) {
const rejectedStep = allStepsRes.find((stepInfo) => stepInfo.status === REJECTED);
if ((rejectedStep as PromiseRejectedResult).reason.code == 400) {
const code = (rejectedStep as PromiseRejectedResult).reason.code;
if (code === 400 || code === 401 || code === 403 || code === 404) {
setStepFailedStatus(MetricsDataFailStatus.PartialFailed4xx);
} else {
setStepFailedStatus(MetricsDataFailStatus.PartialFailedTimeout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const useGetSourceControlConfigurationBranchEffect = (): IUseGetSourceCon
}),
),
);
if (response.code === 400) {
if (response.code === 400 || response.code === 401 || response.code === 403 || response.code === 404) {
setStepFailedStatus(MetricsDataFailStatus.AllFailed4xx);
} else if (response.code === 200) {
setIsGetBranch(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export const useGetSourceControlConfigurationCrewEffect = (): IUseGetSourceContr
setStepFailedStatus(MetricsDataFailStatus.NotFailed);
} else if (hasRejected && hasFulfilled) {
const rejectedStep = allCrewsRes.find((crewInfo) => crewInfo.status === REJECTED);
if ((rejectedStep as PromiseRejectedResult).reason.code == 400) {
const code = (rejectedStep as PromiseRejectedResult).reason.code;
if (code === 400 || code === 401 || code === 403 || code === 404) {
setStepFailedStatus(MetricsDataFailStatus.PartialFailed4xx);
} else {
setStepFailedStatus(MetricsDataFailStatus.PartialFailedTimeout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export const useGetSourceControlConfigurationRepoEffect = (): IUseGetSourceContr
setStepFailedStatus(MetricsDataFailStatus.NotFailed);
} else if (hasRejected && hasFulfilled) {
const rejectedStep = allRepoRes.find((repoInfo) => repoInfo.status === REJECTED);
if ((rejectedStep as PromiseRejectedResult).reason.code == 400) {
const code = (rejectedStep as PromiseRejectedResult).reason.code;
if (code === 400 || code === 401 || code === 403 || code === 404) {
setStepFailedStatus(MetricsDataFailStatus.PartialFailed4xx);
} else {
setStepFailedStatus(MetricsDataFailStatus.PartialFailedTimeout);
Expand Down

0 comments on commit 53cdc50

Please sign in to comment.