14 lines
284 B
TypeScript
14 lines
284 B
TypeScript
|
import useSWR from "swr"
|
||
|
import fetcher from "@/lib/fetcher";
|
||
|
|
||
|
const useCurrentUser = () => {
|
||
|
const { data,error,isLoading,mutate } = useSWR('/api/current',fetcher)
|
||
|
return {
|
||
|
data,
|
||
|
error,
|
||
|
isLoading,
|
||
|
mutate
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default useCurrentUser;
|