umami/hooks/useDelete.js

12 lines
306 B
JavaScript
Raw Normal View History

2020-11-10 06:01:53 +01:00
import { useCallback } from 'react';
import { useRouter } from 'next/router';
import { del } from 'lib/web';
export default function useDelete() {
const { basePath } = useRouter();
return useCallback(async (url, params, headers) => {
return del(`${basePath}${url}`, params, headers);
}, []);
}