Only send events to clients who need it
- User events (star, rating, plays) only sent to same user - Don't send to the client (browser window) that originated the event
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
import { fetchUtils } from 'react-admin'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { baseUrl } from '../utils'
|
||||
import config from '../config'
|
||||
import jwtDecode from 'jwt-decode'
|
||||
|
||||
const customAuthorizationHeader = 'X-ND-Authorization'
|
||||
const clientUniqueIdHeader = 'X-ND-Client-Unique-Id'
|
||||
const clientUniqueId = uuidv4()
|
||||
|
||||
const httpClient = (url, options = {}) => {
|
||||
url = baseUrl(url)
|
||||
if (!options.headers) {
|
||||
options.headers = new Headers({ Accept: 'application/json' })
|
||||
}
|
||||
options.headers.set(clientUniqueIdHeader, clientUniqueId)
|
||||
const token = localStorage.getItem('token')
|
||||
if (token) {
|
||||
options.headers.set(customAuthorizationHeader, `Bearer ${token}`)
|
||||
|
||||
Reference in New Issue
Block a user