aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/http/token.ts
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-04-19 19:37:43 +0800
committercrupest <crupest@outlook.com>2022-04-19 19:37:43 +0800
commit7187553a32af6a0011e5246080ee2edc2be8215e (patch)
tree8b3c7607f3019a307fe58820d99269cfbcd6f88c /FrontEnd/src/http/token.ts
parentb9c770e63da37f3a33e46c69a09f21b4b8d6ad8b (diff)
downloadtimeline-7187553a32af6a0011e5246080ee2edc2be8215e.tar.gz
timeline-7187553a32af6a0011e5246080ee2edc2be8215e.tar.bz2
timeline-7187553a32af6a0011e5246080ee2edc2be8215e.zip
...
Diffstat (limited to 'FrontEnd/src/http/token.ts')
-rw-r--r--FrontEnd/src/http/token.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/FrontEnd/src/http/token.ts b/FrontEnd/src/http/token.ts
index f8b09d63..3de42d21 100644
--- a/FrontEnd/src/http/token.ts
+++ b/FrontEnd/src/http/token.ts
@@ -1,14 +1,18 @@
// Don't use axios in common because it will contains
// authorization header, which shouldn't be used in token apis.
-import axios, { AxiosError } from "axios";
+import originalAxios, { AxiosError } from "axios";
import {
apiBaseUrl,
convertToIfErrorCodeIs,
extractResponseData,
+ configureAxios,
} from "./common";
import { HttpUser } from "./user";
+const axios = originalAxios.create();
+configureAxios(axios);
+
export interface HttpCreateTokenRequest {
username: string;
password: string;
@@ -42,7 +46,7 @@ export interface IHttpTokenClient {
export class HttpTokenClient implements IHttpTokenClient {
create(req: HttpCreateTokenRequest): Promise<HttpCreateTokenResponse> {
return axios
- .post<HttpCreateTokenResponse>(`${apiBaseUrl}/token/create`, req)
+ .post<HttpCreateTokenResponse>(`${apiBaseUrl}/token/create`, req, {})
.then(extractResponseData)
.catch(
convertToIfErrorCodeIs(11010101, HttpCreateTokenBadCredentialError)