diff options
author | crupest <crupest@outlook.com> | 2020-06-04 00:18:50 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-04 00:18:50 +0800 |
commit | 3aa87cc26fd58836b82c067b58a47e08e30a7784 (patch) | |
tree | ba9cf1918d210896ab10bed484a8ddf7c7935e0c /Timeline/ClientApp/src/data/common.ts | |
parent | 1e90a93049cd57098608de72f02bfaabfadd32b6 (diff) | |
download | timeline-3aa87cc26fd58836b82c067b58a47e08e30a7784.tar.gz timeline-3aa87cc26fd58836b82c067b58a47e08e30a7784.tar.bz2 timeline-3aa87cc26fd58836b82c067b58a47e08e30a7784.zip |
refactor(front): Make codes lint-clean!
Diffstat (limited to 'Timeline/ClientApp/src/data/common.ts')
-rw-r--r-- | Timeline/ClientApp/src/data/common.ts | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Timeline/ClientApp/src/data/common.ts b/Timeline/ClientApp/src/data/common.ts index 61db8bd2..e2882a80 100644 --- a/Timeline/ClientApp/src/data/common.ts +++ b/Timeline/ClientApp/src/data/common.ts @@ -9,9 +9,14 @@ export function extractStatusCode(error: AxiosError): number | null { }
}
+export interface CommonErrorResponse {
+ code: number;
+ message: string;
+}
+
export function extractErrorCode(error: AxiosError): number | null {
- const code =
- error.response && error.response.data && error.response.data.code;
+ const { response } = error as AxiosError<CommonErrorResponse>;
+ const code = response && response.data && response.data.code;
if (typeof code === 'number') {
return code;
} else {
|