mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
replace numbers with typed http status codes (#3409)
This commit is contained in:
parent
adc1f09c0d
commit
2d53be0267
149 changed files with 1721 additions and 1108 deletions
|
@ -1,6 +1,6 @@
|
|||
import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests'
|
||||
import { CustomConfig } from '../../models/server/custom-config.model'
|
||||
import { DeepPartial } from '@shared/core-utils'
|
||||
import { DeepPartial, HttpStatusCode } from '@shared/core-utils'
|
||||
import { merge } from 'lodash'
|
||||
|
||||
function getConfig (url: string) {
|
||||
|
@ -9,7 +9,7 @@ function getConfig (url: string) {
|
|||
return makeGetRequest({
|
||||
url,
|
||||
path,
|
||||
statusCodeExpected: 200
|
||||
statusCodeExpected: HttpStatusCode.OK_200
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -19,11 +19,11 @@ function getAbout (url: string) {
|
|||
return makeGetRequest({
|
||||
url,
|
||||
path,
|
||||
statusCodeExpected: 200
|
||||
statusCodeExpected: HttpStatusCode.OK_200
|
||||
})
|
||||
}
|
||||
|
||||
function getCustomConfig (url: string, token: string, statusCodeExpected = 200) {
|
||||
function getCustomConfig (url: string, token: string, statusCodeExpected = HttpStatusCode.OK_200) {
|
||||
const path = '/api/v1/config/custom'
|
||||
|
||||
return makeGetRequest({
|
||||
|
@ -34,7 +34,7 @@ function getCustomConfig (url: string, token: string, statusCodeExpected = 200)
|
|||
})
|
||||
}
|
||||
|
||||
function updateCustomConfig (url: string, token: string, newCustomConfig: CustomConfig, statusCodeExpected = 200) {
|
||||
function updateCustomConfig (url: string, token: string, newCustomConfig: CustomConfig, statusCodeExpected = HttpStatusCode.OK_200) {
|
||||
const path = '/api/v1/config/custom'
|
||||
|
||||
return makePutBodyRequest({
|
||||
|
@ -204,7 +204,7 @@ function updateCustomSubConfig (url: string, token: string, newConfig: DeepParti
|
|||
return updateCustomConfig(url, token, updateParams)
|
||||
}
|
||||
|
||||
function deleteCustomConfig (url: string, token: string, statusCodeExpected = 200) {
|
||||
function deleteCustomConfig (url: string, token: string, statusCodeExpected = HttpStatusCode.OK_200) {
|
||||
const path = '/api/v1/config/custom'
|
||||
|
||||
return makeDeleteRequest({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue