fix for latency badge in browse sessions page
This commit is contained in:
parent
a07ff74dc0
commit
812cedb0e1
|
|
@ -148,7 +148,7 @@ export const getSessions = () => {
|
|||
|
||||
export const getLatencyToUsers = (currentUserId, participantIds) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const options = { user_ids: [participantIds]}
|
||||
const options = { user_ids: participantIds}
|
||||
apiFetch(`/users/${currentUserId}/latencies?${new URLSearchParams(options)}`)
|
||||
.then(response => resolve(response))
|
||||
.catch(error => reject(error))
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export const fetchUserLatencies = createAsyncThunk(
|
|||
'latency/fetchUserLatencies',
|
||||
async (options, thunkAPI) => {
|
||||
const { currentUserId, participantIds } = options
|
||||
//console.log("_DEBUG_ fetchUserLatencies", options);
|
||||
const response = await getLatencyToUsers(currentUserId, participantIds)
|
||||
return response.json()
|
||||
}
|
||||
|
|
@ -30,7 +31,6 @@ export const latencySlice = createSlice({
|
|||
state.status = 'loading'
|
||||
})
|
||||
.addCase(fetchUserLatencies.fulfilled, (state, action) => {
|
||||
console.log("_DEBUG_ fetchUserLatencies", action.payload);
|
||||
const records = new Set([...state.latencies, ...action.payload]);
|
||||
const unique = [];
|
||||
records.map(x => unique.filter(a => a.user_id === x.user_id).length > 0 ? null : unique.push(x))
|
||||
|
|
|
|||
Loading…
Reference in New Issue