1.2.6 - Use custom type for request headers.

master
Tudor Stanciu 2024-03-30 22:41:23 +02:00
parent 5c3c2acfdd
commit 95080ec982
2 changed files with 8 additions and 5 deletions

View File

@ -45,3 +45,4 @@ All tests in the package can be executed by running: `npm test`.
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.6 - Use custom type for request headers.

View File

@ -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}`;
}