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/user-notifications.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/user-notifications.ts')
-rw-r--r-- | shared/extra-utils/users/user-notifications.ts | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/shared/extra-utils/users/user-notifications.ts b/shared/extra-utils/users/user-notifications.ts index 98d222e1d..467a3d959 100644 --- a/shared/extra-utils/users/user-notifications.ts +++ b/shared/extra-utils/users/user-notifications.ts | |||
@@ -11,8 +11,14 @@ import { flushAndRunMultipleServers, ServerInfo } from '../server/servers' | |||
11 | import { getUserNotificationSocket } from '../socket/socket-io' | 11 | import { getUserNotificationSocket } from '../socket/socket-io' |
12 | import { setAccessTokensToServers, userLogin } from './login' | 12 | import { setAccessTokensToServers, userLogin } from './login' |
13 | import { createUser, getMyUserInformation } from './users' | 13 | import { createUser, getMyUserInformation } from './users' |
14 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
14 | 15 | ||
15 | function updateMyNotificationSettings (url: string, token: string, settings: UserNotificationSetting, statusCodeExpected = 204) { | 16 | function updateMyNotificationSettings ( |
17 | url: string, | ||
18 | token: string, | ||
19 | settings: UserNotificationSetting, | ||
20 | statusCodeExpected = HttpStatusCode.NO_CONTENT_204 | ||
21 | ) { | ||
16 | const path = '/api/v1/users/me/notification-settings' | 22 | const path = '/api/v1/users/me/notification-settings' |
17 | 23 | ||
18 | return makePutBodyRequest({ | 24 | return makePutBodyRequest({ |
@@ -31,7 +37,7 @@ async function getUserNotifications ( | |||
31 | count: number, | 37 | count: number, |
32 | unread?: boolean, | 38 | unread?: boolean, |
33 | sort = '-createdAt', | 39 | sort = '-createdAt', |
34 | statusCodeExpected = 200 | 40 | statusCodeExpected = HttpStatusCode.OK_200 |
35 | ) { | 41 | ) { |
36 | const path = '/api/v1/users/me/notifications' | 42 | const path = '/api/v1/users/me/notifications' |
37 | 43 | ||
@@ -49,7 +55,7 @@ async function getUserNotifications ( | |||
49 | }) | 55 | }) |
50 | } | 56 | } |
51 | 57 | ||
52 | function markAsReadNotifications (url: string, token: string, ids: number[], statusCodeExpected = 204) { | 58 | function markAsReadNotifications (url: string, token: string, ids: number[], statusCodeExpected = HttpStatusCode.NO_CONTENT_204) { |
53 | const path = '/api/v1/users/me/notifications/read' | 59 | const path = '/api/v1/users/me/notifications/read' |
54 | 60 | ||
55 | return makePostBodyRequest({ | 61 | return makePostBodyRequest({ |
@@ -61,7 +67,7 @@ function markAsReadNotifications (url: string, token: string, ids: number[], sta | |||
61 | }) | 67 | }) |
62 | } | 68 | } |
63 | 69 | ||
64 | function markAsReadAllNotifications (url: string, token: string, statusCodeExpected = 204) { | 70 | function markAsReadAllNotifications (url: string, token: string, statusCodeExpected = HttpStatusCode.NO_CONTENT_204) { |
65 | const path = '/api/v1/users/me/notifications/read-all' | 71 | const path = '/api/v1/users/me/notifications/read-all' |
66 | 72 | ||
67 | return makePostBodyRequest({ | 73 | return makePostBodyRequest({ |