mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 10:15:17 -04:00
enhancement(auth): better error message handling
Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
parent
8e57188ab5
commit
ca9836d691
37 changed files with 199 additions and 207 deletions
|
@ -15,7 +15,7 @@ import type { AccessToken, AccessTokenWithSecret, CreateAccessTokenDto } from '.
|
|||
* @throws {Error} when the api request wasn't successful.
|
||||
*/
|
||||
export const getAccessTokenList = async (): Promise<AccessToken[]> => {
|
||||
const response = await new GetApiRequestBuilder<AccessToken[]>('tokens', 'tokens').sendRequest()
|
||||
const response = await new GetApiRequestBuilder<AccessToken[]>('tokens').sendRequest()
|
||||
return response.asParsedJsonObject()
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ export const getAccessTokenList = async (): Promise<AccessToken[]> => {
|
|||
* @throws {Error} when the api request wasn't successful.
|
||||
*/
|
||||
export const postNewAccessToken = async (label: string, validUntil: number): Promise<AccessTokenWithSecret> => {
|
||||
const response = await new PostApiRequestBuilder<AccessTokenWithSecret, CreateAccessTokenDto>('tokens', 'tokens')
|
||||
const response = await new PostApiRequestBuilder<AccessTokenWithSecret, CreateAccessTokenDto>('tokens')
|
||||
.withJsonBody({
|
||||
label,
|
||||
validUntil
|
||||
|
@ -44,5 +44,5 @@ export const postNewAccessToken = async (label: string, validUntil: number): Pro
|
|||
* @throws {Error} when the api request wasn't successful.
|
||||
*/
|
||||
export const deleteAccessToken = async (keyId: string): Promise<void> => {
|
||||
await new DeleteApiRequestBuilder('tokens/' + keyId, 'tokens').sendRequest()
|
||||
await new DeleteApiRequestBuilder('tokens/' + keyId).sendRequest()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue