diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-02 18:15:41 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-02 18:15:41 +0200 |
commit | e030bfb59dd5ee65f20a64686ec9b22ca39f70ae (patch) | |
tree | c9a439159ef540291e3c030bcaf958b953442147 /client/src/standalone/videos | |
parent | 463206948d6a9d46e7e68d55c7b763e601ecc870 (diff) | |
download | PeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.tar.gz PeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.tar.zst PeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.zip |
Refactor server errors handler
Diffstat (limited to 'client/src/standalone/videos')
-rw-r--r-- | client/src/standalone/videos/embed.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index fc61d3730..4ce5c78e8 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts | |||
@@ -5,6 +5,7 @@ import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-c | |||
5 | import { | 5 | import { |
6 | ClientHookName, | 6 | ClientHookName, |
7 | HTMLServerConfig, | 7 | HTMLServerConfig, |
8 | OAuth2ErrorCode, | ||
8 | PluginType, | 9 | PluginType, |
9 | ResultList, | 10 | ResultList, |
10 | UserRefreshToken, | 11 | UserRefreshToken, |
@@ -118,8 +119,8 @@ export class PeerTubeEmbed { | |||
118 | if (res.status === HttpStatusCode.UNAUTHORIZED_401) return undefined | 119 | if (res.status === HttpStatusCode.UNAUTHORIZED_401) return undefined |
119 | 120 | ||
120 | return res.json() | 121 | return res.json() |
121 | }).then((obj: UserRefreshToken & { code: 'invalid_grant'}) => { | 122 | }).then((obj: UserRefreshToken & { code?: OAuth2ErrorCode }) => { |
122 | if (!obj || obj.code === 'invalid_grant') { | 123 | if (!obj || obj.code === OAuth2ErrorCode.INVALID_GRANT) { |
123 | Tokens.flush() | 124 | Tokens.flush() |
124 | this.removeTokensFromHeaders() | 125 | this.removeTokensFromHeaders() |
125 | 126 | ||