update usePatch, implement actions
This commit is contained in:
1 parent
aae1fefb31
commit
f9d0ab5e07
7 files changed
+181
-131
No files matched your search
@@ -58,11 +58,15 @@ export const usePost = <B = any, R = any>(endpoint: string) => {
|
||||
return { post: postFn, loading, error };
|
||||
};
|
||||
|
||||
export const usePatch = <B = any, R = any>(endpoint: string) => {
|
||||
export const usePatch = <B = any, R = any>() => {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const patchFn = async (body: B, config?: AxiosRequestConfig): Promise<R | null> => {
|
||||
const patchFn = async (
|
||||
endpoint: string,
|
||||
body?: B,
|
||||
config?: AxiosRequestConfig
|
||||
): Promise<R | null> => {
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
|
||||
|
||||
Reference in new issue
Block a user