fix missing station id on connect & server api call
This commit is contained in:
@@ -22,16 +22,13 @@ export const ConnectionBtn = () => {
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
/* getStations().then((data) => {
|
||||
setStations(data);
|
||||
if (data[0]) {
|
||||
setForm({
|
||||
...form,
|
||||
selectedStationId: data[0].id,
|
||||
});
|
||||
}
|
||||
}); */
|
||||
}, [connection.status, form]);
|
||||
if (stations && stations.length > 0 && form.selectedStationId === null) {
|
||||
setForm((prevForm) => ({
|
||||
...prevForm,
|
||||
selectedStationId: stations[0]?.id ?? null,
|
||||
}));
|
||||
}
|
||||
}, [stations, form.selectedStationId]);
|
||||
|
||||
const session = useSession();
|
||||
const uid = session.data?.user?.id;
|
||||
|
||||
Reference in New Issue
Block a user