mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-07-09 15:08:06 +00:00
fix(Bar map / profile): filtered bar where name != null / fix prefgender
This commit is contained in:
@@ -73,16 +73,15 @@ export default function Dashboard() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* UTILISER refetch (image sur discord)
|
||||||
|
* https://tanstack.com/query/v3/docs/react/reference/useQuery ---> tout en bas
|
||||||
*
|
*
|
||||||
* Avec newMatch, faire une fonction qui refetch le user et qui affiche
|
* dans onSuccess de useQuery
|
||||||
* un modal avec les infos du user matché
|
* on filtre l'objet Notification de loggedUser par le type (match)
|
||||||
|
* setMatchNotification = [...filteredNotification],
|
||||||
*
|
*
|
||||||
* (peut etre invalidateQueries mais apres je sais pas comment on la relance)
|
* et on passe dans le modal la premiere notif de type match
|
||||||
*
|
* et on enleve au fur et a mesure (sur la BD aussi)
|
||||||
* Si j'arrive à faire le invalidateQueries, je met dans le useQuery
|
|
||||||
* onSuccess: (loggedUser) => {
|
|
||||||
* if (loggedUser.match.length > 0)
|
|
||||||
* afficher le modal
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -20,6 +20,7 @@ export default function Map() {
|
|||||||
const toast = useToast({ position: "bottom" });
|
const toast = useToast({ position: "bottom" });
|
||||||
const idSaveToast = "saved_location";
|
const idSaveToast = "saved_location";
|
||||||
const { data: session, status } = useSession();
|
const { data: session, status } = useSession();
|
||||||
|
const [listBars, setListBars] = useState({} as unknown as any);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
isLoading,
|
isLoading,
|
||||||
@@ -43,7 +44,7 @@ export default function Map() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: listBars,
|
data,
|
||||||
isError: isErrorListBars,
|
isError: isErrorListBars,
|
||||||
isLoading: isLoadingListBars,
|
isLoading: isLoadingListBars,
|
||||||
error: errorListBars,
|
error: errorListBars,
|
||||||
@@ -71,6 +72,11 @@ export default function Map() {
|
|||||||
return err;
|
return err;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
onSuccess: (data) => {
|
||||||
|
// filter data where name is not null
|
||||||
|
const filteredData = data.filter((bar: any) => bar.name !== null);
|
||||||
|
setListBars(filteredData);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const userSetLocation = useMutation({
|
const userSetLocation = useMutation({
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ export default function UserProfile() {
|
|||||||
defaultValue={
|
defaultValue={
|
||||||
userData.prefGender === null
|
userData.prefGender === null
|
||||||
? Gender.UNKNOWN
|
? Gender.UNKNOWN
|
||||||
: userData.gender
|
: userData.prefGender
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user