Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 98x 1188x 1188x 1166x 22x 22x 22x 98x 353x 72x | import { useQuery } from "@tanstack/react-query"; import { API } from "aws-amplify"; import { UserRole } from "shared-types/events/legacy-user"; import { sendGAEvent } from "@/utils/ReactGA/SendGAEvent"; export type UserDetails = { id: string; eventType: string; email: string; fullName: string; role?: UserRole; states?: string[]; division: string; group: string; }; export const getUserDetails = async (userEmail?: string): Promise<UserDetails | null> => { try { const userDetails = await API.post("os", "/getUserDetails", { body: { userEmail } }); return userDetails as UserDetails; } catch (e) { sendGAEvent("api_error", { message: "failure /getUserDetails", }); console.log({ e }); return null; } }; export const useGetUserDetails = () => useQuery({ queryKey: ["userDetails"], queryFn: () => getUserDetails(), }); |