propro-common-components 0.1.43 → 0.1.45
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.
@@ -0,0 +1,7 @@
|
|
1
|
+
import { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
2
|
+
interface FetchDataParams<TData> {
|
3
|
+
endpoint: string;
|
4
|
+
options?: Omit<UseQueryOptions<TData, Error>, 'queryKey' | 'queryFn'>;
|
5
|
+
}
|
6
|
+
export declare function useGet<TData = unknown>(key: string[], { endpoint, options }: FetchDataParams<TData>): UseQueryResult<TData, Error>;
|
7
|
+
export default useGet;
|
package/dist/api/useMutate.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { QueryKey, UseMutationOptions, UseMutationResult } from "@tanstack/react-query";
|
2
2
|
import { AxiosError, AxiosRequestConfig } from "axios";
|
3
3
|
import { ToastOptions } from "react-toastify";
|
4
|
-
declare const useMutate: ({ url, method, headers, invalidateAllQueries, successLog, errorLog, logURL, toastMessage, onSuccess, onError, }: {
|
4
|
+
declare const useMutate: <TData = unknown, TError = AxiosError<unknown, any>, TVariables = void, TContext = unknown>({ url, method, headers, invalidateAllQueries, successLog, errorLog, logURL, toastMessage, onSuccess, onError, }: {
|
5
5
|
url: string;
|
6
6
|
method: "POST" | "PUT" | "DELETE" | "PATCH";
|
7
7
|
headers?: AxiosRequestConfig["headers"];
|
@@ -17,6 +17,6 @@ declare const useMutate: ({ url, method, headers, invalidateAllQueries, successL
|
|
17
17
|
options?: ToastOptions<unknown> | undefined;
|
18
18
|
} | undefined;
|
19
19
|
onSuccess?: ((res: unknown) => void) | undefined;
|
20
|
-
onError?: ((err:
|
21
|
-
}, options?: UseMutationOptions<
|
20
|
+
onError?: ((err: TError) => void) | undefined;
|
21
|
+
}, options?: UseMutationOptions<TData, TError, TVariables, TContext> | undefined) => UseMutationResult<TData, TError, TVariables, TContext>;
|
22
22
|
export default useMutate;
|
@@ -29616,7 +29616,7 @@ const AccountManagement = () => {
|
|
29616
29616
|
}
|
29617
29617
|
if (!getCookie("has_account_token"))
|
29618
29618
|
try {
|
29619
|
-
await axios.post("/api/
|
29619
|
+
await axios.post("/api/refreshToken");
|
29620
29620
|
} catch {
|
29621
29621
|
setTimeout(() => {
|
29622
29622
|
handleAuth();
|
@@ -29628,7 +29628,6 @@ const AccountManagement = () => {
|
|
29628
29628
|
draggable: !0,
|
29629
29629
|
progress: void 0,
|
29630
29630
|
theme: "light",
|
29631
|
-
isLoading: !0,
|
29632
29631
|
autoClose: !1
|
29633
29632
|
});
|
29634
29633
|
}
|
@@ -29690,8 +29689,7 @@ const useMutate = ({
|
|
29690
29689
|
className: "hidden",
|
29691
29690
|
id: "avatar-input",
|
29692
29691
|
onChange: async (g) => {
|
29693
|
-
|
29694
|
-
b.append("file", g.target.files[0]), await m(b);
|
29692
|
+
new FormData().append("file", g.target.files[0]);
|
29695
29693
|
}
|
29696
29694
|
}
|
29697
29695
|
),
|
package/package.json
CHANGED
package/dist/api/useGet.d.ts
DELETED
@@ -1,3 +0,0 @@
|
|
1
|
-
import { DefaultError, DefinedUseQueryResult, UseQueryResult } from "@tanstack/react-query";
|
2
|
-
declare const useGet: (key: string[], endpoint: string, options?: object) => UseQueryResult<unknown, DefaultError> | DefinedUseQueryResult<unknown, DefaultError>;
|
3
|
-
export default useGet;
|