update usePatch, implement actions

This commit is contained in:
Alex Holliday committed 2025-10-08 14:28:51 -07:00
1 parent aae1fefb31
commit f9d0ab5e07
7 files changed
+181 -131

No files matched your search

+6 -2
View File
@@ -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);