diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-07 14:32:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 14:32:36 +0100 |
commit | 2d53be0267acc49cda46707b885096193a1f4e9c (patch) | |
tree | 887061a34bc67f40acbb96a6278f9544bf83caeb /shared/extra-utils/users/accounts.ts | |
parent | adc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff) | |
download | PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.gz PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.zst PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.zip |
replace numbers with typed http status codes (#3409)
Diffstat (limited to 'shared/extra-utils/users/accounts.ts')
-rw-r--r-- | shared/extra-utils/users/accounts.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/shared/extra-utils/users/accounts.ts b/shared/extra-utils/users/accounts.ts index f87706f6a..4ea7f1402 100644 --- a/shared/extra-utils/users/accounts.ts +++ b/shared/extra-utils/users/accounts.ts | |||
@@ -8,8 +8,9 @@ import { Account } from '../../models/actors' | |||
8 | import { root } from '../miscs/miscs' | 8 | import { root } from '../miscs/miscs' |
9 | import { makeGetRequest } from '../requests/requests' | 9 | import { makeGetRequest } from '../requests/requests' |
10 | import { VideoRateType } from '../../models/videos' | 10 | import { VideoRateType } from '../../models/videos' |
11 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
11 | 12 | ||
12 | function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = 200) { | 13 | function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = HttpStatusCode.OK_200) { |
13 | const path = '/api/v1/accounts' | 14 | const path = '/api/v1/accounts' |
14 | 15 | ||
15 | return makeGetRequest({ | 16 | return makeGetRequest({ |
@@ -20,7 +21,7 @@ function getAccountsList (url: string, sort = '-createdAt', statusCodeExpected = | |||
20 | }) | 21 | }) |
21 | } | 22 | } |
22 | 23 | ||
23 | function getAccount (url: string, accountName: string, statusCodeExpected = 200) { | 24 | function getAccount (url: string, accountName: string, statusCodeExpected = HttpStatusCode.OK_200) { |
24 | const path = '/api/v1/accounts/' + accountName | 25 | const path = '/api/v1/accounts/' + accountName |
25 | 26 | ||
26 | return makeGetRequest({ | 27 | return makeGetRequest({ |
@@ -55,7 +56,13 @@ async function checkActorFilesWereRemoved (filename: string, serverNumber: numbe | |||
55 | } | 56 | } |
56 | } | 57 | } |
57 | 58 | ||
58 | function getAccountRatings (url: string, accountName: string, accessToken: string, rating?: VideoRateType, statusCodeExpected = 200) { | 59 | function getAccountRatings ( |
60 | url: string, | ||
61 | accountName: string, | ||
62 | accessToken: string, | ||
63 | rating?: VideoRateType, | ||
64 | statusCodeExpected = HttpStatusCode.OK_200 | ||
65 | ) { | ||
59 | const path = '/api/v1/accounts/' + accountName + '/ratings' | 66 | const path = '/api/v1/accounts/' + accountName + '/ratings' |
60 | 67 | ||
61 | const query = rating ? { rating } : {} | 68 | const query = rating ? { rating } : {} |