add: order paths & mds
This commit is contained in:
@@ -92,4 +92,22 @@ export const useDeletePath = () => {
|
||||
},
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
export const useMovePath = () => {
|
||||
const queryClient = useQueryClient();
|
||||
const config = useConfig();
|
||||
|
||||
return useMutation(
|
||||
({path, direction}) => {
|
||||
const apiEndpoint = `${config.BACKEND_HOST}/api/path/move_${direction}/${path.id}`;
|
||||
return fetch_(apiEndpoint, {method: "PATCH"});
|
||||
},
|
||||
{
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries("paths");
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user