PeerTube/shared/extra-utils/server/stats.ts

23 lines
414 B
TypeScript
Raw Normal View History

2018-11-19 10:08:18 -06:00
import { makeGetRequest } from '../requests/requests'
2018-02-28 11:04:46 -06:00
2018-09-14 07:57:59 -05:00
function getStats (url: string, useCache = false) {
2018-02-28 11:04:46 -06:00
const path = '/api/v1/server/stats'
2018-09-14 07:57:59 -05:00
const query = {
t: useCache ? undefined : new Date().getTime()
}
2018-02-28 11:04:46 -06:00
return makeGetRequest({
url,
path,
2018-09-14 07:57:59 -05:00
query,
2018-02-28 11:04:46 -06:00
statusCodeExpected: 200
})
}
// ---------------------------------------------------------------------------
export {
getStats
}