1
0
Fork 0
peertube/shared/extra-utils/server/stats.ts

24 lines
515 B
TypeScript
Raw Normal View History

2018-11-19 16:08:18 +00:00
import { makeGetRequest } from '../requests/requests'
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
2018-02-28 17:04:46 +00:00
2018-09-14 12:57:59 +00:00
function getStats (url: string, useCache = false) {
2018-02-28 17:04:46 +00:00
const path = '/api/v1/server/stats'
2018-09-14 12:57:59 +00:00
const query = {
t: useCache ? undefined : new Date().getTime()
}
2018-02-28 17:04:46 +00:00
return makeGetRequest({
url,
path,
2018-09-14 12:57:59 +00:00
query,
statusCodeExpected: HttpStatusCode.OK_200
2018-02-28 17:04:46 +00:00
})
}
// ---------------------------------------------------------------------------
export {
getStats
}