diff --git a/src/screens/UserLoginScreen.tsx b/src/screens/UserLoginScreen.tsx index 6a032a7..1a2f3aa 100644 --- a/src/screens/UserLoginScreen.tsx +++ b/src/screens/UserLoginScreen.tsx @@ -1,6 +1,7 @@ import { useUserAuthenticationContext } from "@/contexts/UserAuthenticationContext"; import type { UnloggedUserStackScreenComponentProps } from "@/navigations/Types"; import authenticateUser from "@/utils/requests/authenticateUser"; +import getUserInformations from "@/utils/requests/userInformations"; import Button from "@components/Button"; import ContainerBorderTopCurved from "@components/ContainerBorderTopCurved"; import Input from "@components/Input"; @@ -31,7 +32,9 @@ const UserLoginScreen: UnloggedUserStackScreenComponentProps<"userLoginScreen"> setAuthenticationData(data); // navigation.popToTop(); // navigation.replace("bottomTabs"); - navigation.navigate("bottomTabs"); + // navigation.navigate("bottomTabs"); + const userInformations = userInformationsMutation.mutate(data.access); + console.log(userInformations); }, // biome-ignore lint/suspicious/noExplicitAny: onError: (error: AxiosError) => { @@ -47,6 +50,19 @@ const UserLoginScreen: UnloggedUserStackScreenComponentProps<"userLoginScreen"> }, }); + const userInformationsMutation = useMutation({ + mutationFn: (userAccessToken: string) => getUserInformations(userAccessToken), + onSuccess: (data) => { + console.log("Data userInformationsMutation", data); + + // TODO : Navigate to bottomTabs + navigation.navigate("bottomTabs"); + }, + onError: (error) => { + console.log("Error userInformationsMutation", error); + }, + }); + const submit = useCallback(() => { authenticationMutation.mutate({ username: email,