@tracktor/shared-module 0.12.0 → 0.13.0

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  # [Versions](https://github.com/Tracktor/shared-module/releases)
2
2
 
3
- ## v0.12.0
4
- - **[docs]** : Add documentation default props for `AxiosConfig` component
5
- - **[feat]** : Add new props `tokenTypeKey` and `tokenKey` for `AxiosConfig` component
3
+ ## v0.13.0
4
+ - **[feat]** : add `useAuth` hook
5
+ - **[feat]** : type improvements
@@ -28,5 +28,5 @@ interface MaskTextFieldProps<T> {
28
28
  */
29
29
  IMaskMixin: (param: (props: any) => any) => any;
30
30
  }
31
- declare const MaskTextField: <T extends ComponentType<{}>>({ IMaskMixin, ...props }: MaskTextFieldProps<T> & ComponentProps<T>) => import("react/jsx-runtime").JSX.Element;
31
+ declare const MaskTextField: <T extends ComponentType>({ IMaskMixin, ...props }: MaskTextFieldProps<T> & ComponentProps<T>) => import("react/jsx-runtime").JSX.Element;
32
32
  export default MaskTextField;
@@ -31,6 +31,9 @@ export declare const getOrvalOperationName: (_: any, route: string, method: stri
31
31
  */
32
32
  export declare const getOrvalConfig: (config?: CustomOrvalConfig) => {
33
33
  readonly api: {
34
+ readonly hooks: {
35
+ readonly afterAllFilesWrite: "prettier src/api/ --write";
36
+ };
34
37
  readonly input: string;
35
38
  readonly output: {
36
39
  readonly client: "react-query";
@@ -0,0 +1,2 @@
1
+ import useInfiniteDataGrid from "./useAuth";
2
+ export default useInfiniteDataGrid;
@@ -0,0 +1,21 @@
1
+ export interface useAuthParams {
2
+ /**
3
+ * Axios instance
4
+ */
5
+ defaults: {
6
+ baseURL?: string;
7
+ headers: {
8
+ common: {
9
+ Authorization?: any;
10
+ };
11
+ };
12
+ };
13
+ }
14
+ declare const useAuth: <T>(axios: useAuthParams & T) => {
15
+ clearAuthenticationToken: () => void;
16
+ setAuthenticationToken: ({ tokenType, accessToken }: {
17
+ tokenType: string;
18
+ accessToken: string;
19
+ }) => void;
20
+ };
21
+ export default useAuth;
@@ -23,10 +23,10 @@ interface GridRowScrollEndParams {
23
23
  * @param isLoading
24
24
  * @param enabled
25
25
  */
26
- declare const useInfiniteDataGrid: <T extends unknown>({ data, fetchNextPage, isFetchingNextPage, isInitialLoading, isLoading, enabled, }: useInfiniteDataGridParams<T>) => {
26
+ declare const useInfiniteDataGrid: <T>({ data, fetchNextPage, isFetchingNextPage, isInitialLoading, isLoading, enabled, }: useInfiniteDataGridParams<T>) => {
27
27
  fetchNextPageOnRowsScrollEnd: (params: GridRowScrollEndParams) => Promise<void>;
28
28
  isLoading: boolean;
29
29
  loadingVariant: "skeleton" | "linear";
30
- rows: T | undefined;
30
+ rows: T[];
31
31
  };
32
32
  export default useInfiniteDataGrid;
package/dist/main.d.ts CHANGED
@@ -20,5 +20,7 @@ export { default as useResponseError } from './hooks/useResponseError';
20
20
  export * from './hooks/useResponseError';
21
21
  export { default as useInfiniteDataGrid } from './hooks/useInfiniteDataGrid';
22
22
  export * from './hooks/useInfiniteDataGrid';
23
+ export { default as useAuth } from './hooks/useAuth';
24
+ export * from './hooks/useAuth';
23
25
  export { default as getOrvalConfig } from './config/orval';
24
26
  export * from './config/orval';