fix missing station id on connect & server api call
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { serverApi } from "helpers/axios";
|
||||||
import {
|
import {
|
||||||
handleActiveSpeakerChange,
|
handleActiveSpeakerChange,
|
||||||
handleDisconnect,
|
handleDisconnect,
|
||||||
@@ -23,8 +24,8 @@ type TalkState = {
|
|||||||
room: Room | null;
|
room: Room | null;
|
||||||
};
|
};
|
||||||
const getToken = async (roomName: string) => {
|
const getToken = async (roomName: string) => {
|
||||||
const response = await fetch(`/api/livekit/token?roomName=${roomName}`);
|
const response = await serverApi.get(`/livekit/token?roomName=${roomName}`);
|
||||||
const data = await response.json();
|
const data = response.data;
|
||||||
return data.token;
|
return data.token;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -22,16 +22,13 @@ export const ConnectionBtn = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
/* getStations().then((data) => {
|
if (stations && stations.length > 0 && form.selectedStationId === null) {
|
||||||
setStations(data);
|
setForm((prevForm) => ({
|
||||||
if (data[0]) {
|
...prevForm,
|
||||||
setForm({
|
selectedStationId: stations[0]?.id ?? null,
|
||||||
...form,
|
}));
|
||||||
selectedStationId: data[0].id,
|
}
|
||||||
});
|
}, [stations, form.selectedStationId]);
|
||||||
}
|
|
||||||
}); */
|
|
||||||
}, [connection.status, form]);
|
|
||||||
|
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
const uid = session.data?.user?.id;
|
const uid = session.data?.user?.id;
|
||||||
|
|||||||
Reference in New Issue
Block a user