@tracktor/shared-module 2.1.4 → 2.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -2
- package/dist/components/Utils/InitializeAxiosConfig.d.ts +0 -5
- package/dist/components/Utils/RequireAuth.d.ts +0 -4
- package/dist/config/orval/mutator/axiosCustomInstance.d.ts +0 -1
- package/dist/config/orval/mutator/axiosCustomInstance.ts +2 -2
- package/dist/context/InjectDependenciesProvider.d.ts +0 -1
- package/dist/hooks/useAuth/useAuth.d.ts +1 -8
- package/dist/main.js +335 -337
- package/dist/main.umd.cjs +10 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import { InjectDependenciesContextProps } from '../../context/InjectDependenciesProvider';
|
|
2
1
|
interface InitializeAxiosConfigProps {
|
|
3
|
-
/**
|
|
4
|
-
* Axios library
|
|
5
|
-
*/
|
|
6
|
-
axios?: NonNullable<InjectDependenciesContextProps["libraries"]>["axios"];
|
|
7
2
|
/**
|
|
8
3
|
* User local storage key
|
|
9
4
|
* @default user
|
|
@@ -5,10 +5,6 @@ export interface RequireAuthProps {
|
|
|
5
5
|
* React router is a libraries dependencies
|
|
6
6
|
*/
|
|
7
7
|
reactRouter?: NonNullable<InjectDependenciesContextProps["libraries"]>["reactRouter"];
|
|
8
|
-
/**
|
|
9
|
-
* Axios is a libraries dependencies
|
|
10
|
-
*/
|
|
11
|
-
axios?: NonNullable<InjectDependenciesContextProps["libraries"]>["axios"];
|
|
12
8
|
/**
|
|
13
9
|
* Is user logged in
|
|
14
10
|
*/
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AxiosError, AxiosRequestConfig } from "axios";
|
|
2
|
-
export declare const AXIOS_INSTANCE: import("axios").AxiosInstance;
|
|
3
2
|
export declare const axiosCustomInstance: <T>(config: AxiosRequestConfig, options?: AxiosRequestConfig) => Promise<T>;
|
|
4
3
|
export default axiosCustomInstance;
|
|
5
4
|
export type ErrorType<Error> = AxiosError<Error>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import axios, { AxiosError, AxiosRequestConfig } from "axios";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
axios.create();
|
|
4
4
|
|
|
5
5
|
export const axiosCustomInstance = <T>(config: AxiosRequestConfig, options?: AxiosRequestConfig): Promise<T> => {
|
|
6
6
|
const source = axios.CancelToken.source();
|
|
7
7
|
|
|
8
|
-
const promise =
|
|
8
|
+
const promise = axios({
|
|
9
9
|
...config,
|
|
10
10
|
...options,
|
|
11
11
|
cancelToken: source.token,
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
interface useAuthParams {
|
|
3
|
-
/**
|
|
4
|
-
* Axios library
|
|
5
|
-
*/
|
|
6
|
-
axios?: NonNullable<InjectDependenciesContextProps["libraries"]>["axios"];
|
|
7
|
-
}
|
|
8
|
-
declare const useAuth: (params?: useAuthParams) => {
|
|
1
|
+
declare const useAuth: () => {
|
|
9
2
|
clearAuthenticationToken: () => void;
|
|
10
3
|
setAuthenticationToken: ({ tokenType, accessToken }: {
|
|
11
4
|
tokenType: string;
|