mirror of
https://github.com/plausible/analytics.git
synced 2024-11-26 23:27:54 +03:00
Fix console errors when using shared links
This commit is contained in:
parent
58cff47b6f
commit
28d293e2d2
@ -47,7 +47,7 @@ export function serializeQuery(query, extraQuery=[]) {
|
||||
return '?' + serialize(queryObj)
|
||||
}
|
||||
|
||||
export function get(url, query, ...extraQuery) {
|
||||
export function get(url, query={}, ...extraQuery) {
|
||||
const headers = SHARED_LINK_AUTH ? {'X-Shared-Link-Auth': SHARED_LINK_AUTH} : {}
|
||||
url = url + serializeQuery(query, extraQuery)
|
||||
return fetch(url, {signal: abortController.signal, headers: headers})
|
||||
|
@ -27,6 +27,8 @@ export default class SiteSwitcher extends React.Component {
|
||||
}
|
||||
|
||||
populateSites() {
|
||||
if (!this.props.loggedIn) return;
|
||||
|
||||
fetch('/api/sites')
|
||||
.then( response => {
|
||||
if (!response.ok) { throw response }
|
||||
|
@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import * as api from '../api'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { countFilters } from '../query';
|
||||
|
||||
@ -14,11 +15,7 @@ export default class CurrentVisitors extends React.Component {
|
||||
}
|
||||
|
||||
updateCount() {
|
||||
return fetch(`/api/stats/${encodeURIComponent(this.props.site.domain)}/current-visitors`)
|
||||
.then( response => {
|
||||
if (!response.ok) { throw response }
|
||||
return response.json()
|
||||
})
|
||||
return api.get(`/api/stats/${encodeURIComponent(this.props.site.domain)}/current-visitors`)
|
||||
.then((res) => this.setState({currentVisitors: res}))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user