Skip to content
Snippets Groups Projects
Commit e84eda0f authored by Fatih20's avatar Fatih20
Browse files

Add username to calling gym application.

parent 1da761b5
No related merge requests found
...@@ -2,6 +2,7 @@ import { ReactNode, createContext, useContext } from "react"; ...@@ -2,6 +2,7 @@ import { ReactNode, createContext, useContext } from "react";
import { QueryStatus, useQuery } from "react-query"; import { QueryStatus, useQuery } from "react-query";
import { GymApplicationReturned } from "../validationSchema/gymApplication"; import { GymApplicationReturned } from "../validationSchema/gymApplication";
import { getGymApplication } from "../api/gymApplication"; import { getGymApplication } from "../api/gymApplication";
import { useUser } from "./AuthProvider";
const GymApplicationsContext = createContext<{ const GymApplicationsContext = createContext<{
gymApplications: GymApplicationReturned[] | undefined; gymApplications: GymApplicationReturned[] | undefined;
...@@ -16,12 +17,14 @@ export function useGymApplications() { ...@@ -16,12 +17,14 @@ export function useGymApplications() {
} }
function GymApplicationProvider({ children }: { children: ReactNode }) { function GymApplicationProvider({ children }: { children: ReactNode }) {
const { user } = useUser();
const { status: gymApplicationsStatus, data: gymApplications } = useQuery( const { status: gymApplicationsStatus, data: gymApplications } = useQuery(
["applications"], ["applications"],
getGymApplication, () => getGymApplication({ username: user?.username || "" }),
{ {
cacheTime: 300000, cacheTime: 300000,
retry: 3, retry: 3,
enabled: !!user,
} }
); );
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment