mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-13 04:57:34 +01:00
12 lines
306 B
JavaScript
12 lines
306 B
JavaScript
|
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);
|
||
|
}, []);
|
||
|
}
|