Skip to content

Commit

Permalink
fix: update request interceptor (#2642)
Browse files Browse the repository at this point in the history
  • Loading branch information
oil-oil authored Oct 17, 2022
1 parent e771935 commit 8e591ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions web/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ export const request: RequestConfig = {
}

const data = await res.json();
const { code = -1 } = data as Res<any>;
if (code !== 0) {
const { success } = data as Res<any>;
if (!success) {
// eslint-disable-next-line
return Promise.reject({ response: res, data });
}
Expand Down
2 changes: 1 addition & 1 deletion web/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ declare const REACT_APP_ENV: 'test' | 'dev' | 'pre' | false;
type PageMode = 'CREATE' | 'EDIT' | 'VIEW';

type Res<T> = {
code: number;
success: boolean;
message: string;
request_id: string;
data: T;
Expand Down

0 comments on commit 8e591ff

Please sign in to comment.