Merge pull request #3009 from bluewave-labs/feat/v2-implement-actions

update usePatch, implement actions
This commit is contained in:
Alexander Holliday authored and GitHub committed 2025-10-08 15:00:43 -07:00
commit c4906d069a
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);