diff --git a/README.md b/README.md index 5e68ced..a8668bb 100644 --- a/README.md +++ b/README.md @@ -44,4 +44,5 @@ All tests in the package can be executed by running: `npm test`. 1.2.2 - Upgraded @flare/js-utils package. 1.2.3 - Added user group and role types after enriching the "user-info" result. 1.2.4 - Password encoding at login. -1.2.5 - The token "expires in" information measuring unit was changed from milliseconds to seconds. +1.2.5 - The token "expires in" information measuring unit was changed from milliseconds to seconds. +1.2.6 - Use custom type for request headers. diff --git a/src/utils/axios.ts b/src/utils/axios.ts index 12f7632..adc9858 100644 --- a/src/utils/axios.ts +++ b/src/utils/axios.ts @@ -1,13 +1,15 @@ // Copyright (c) 2023 Tudor Stanciu -import axios, { AxiosHeaders } from "axios"; +import axios from "axios"; import { fetch } from "../state"; -function getHeaders(): AxiosHeaders { +type Headers = { [key: string]: string }; + +function getHeaders(): Headers { const { token } = fetch(); - const headers = new AxiosHeaders({ + const headers: Headers = { "Content-Type": "application/json" - }); + }; if (token) { headers.Authorization = `Tuitio ${token}`; }