NextJSNetflix/hooks/useCurrentUser.ts

14 lines
284 B
TypeScript
Raw Normal View History

2023-06-04 12:33:10 +00:00
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;