- Updated import statements in `textarea.tsx`, `toggle.tsx`, and `tooltip.tsx` for consistency. - Added missing semicolons and adjusted formatting in `use-mobile.ts` and `use-mobile.tsx`. - Cleaned up `package.json` and `root.json` files by removing unnecessary line breaks. - Simplified `turbo.json` by consolidating array formatting for better readability.
19 lines
437 B
TypeScript
19 lines
437 B
TypeScript
import { useDataSource } from "@erp/core/hooks";
|
|
import { useQuery } from "@tanstack/react-query";
|
|
|
|
import { useAuth } from "../hooks";
|
|
|
|
import type { User } from "./types";
|
|
|
|
export const useCurrentUser = () => {
|
|
const { token } = useAuth();
|
|
const client = useDataSource();
|
|
|
|
return useQuery({
|
|
queryKey: ["me"],
|
|
queryFn: () => client.getOne<User>("/auth", "me"),
|
|
enabled: !!token,
|
|
staleTime: 1000 * 60 * 5,
|
|
});
|
|
};
|