1
0
mirror of https://github.com/kremalicious/umami.git synced 2024-12-30 16:57:44 +01:00
umami/hooks/usePost.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 { post } from 'lib/web';
export default function usePost() {
const { basePath } = useRouter();
return useCallback(async (url, params, headers) => {
return post(`${basePath}${url}`, params, headers);
}, []);
}