aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/data/common.ts
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-06-04 00:18:50 +0800
committercrupest <crupest@outlook.com>2020-06-04 00:18:50 +0800
commitfccd6b4ca8ed7420f25f0c4298fde311bc1e09d0 (patch)
tree787cda66f8997ba842601a261a36b6de95398675 /Timeline/ClientApp/src/data/common.ts
parent92e50c4a3ea250dc18c76bc8c29d86d486e63772 (diff)
downloadtimeline-fccd6b4ca8ed7420f25f0c4298fde311bc1e09d0.tar.gz
timeline-fccd6b4ca8ed7420f25f0c4298fde311bc1e09d0.tar.bz2
timeline-fccd6b4ca8ed7420f25f0c4298fde311bc1e09d0.zip
refactor(front): Make codes lint-clean!
Diffstat (limited to 'Timeline/ClientApp/src/data/common.ts')
-rw-r--r--Timeline/ClientApp/src/data/common.ts9
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 {