1.2.6 - Use custom type for request headers.
parent
5c3c2acfdd
commit
95080ec982
|
@ -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.
|
||||
|
|
|
@ -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}`;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue