mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -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
|
@ -17,7 +17,7 @@ import type { Alias, NewAliasDto, PrimaryAliasDto } from './types'
|
|||
* @throws {Error} when the api request wasn't successfull
|
||||
*/
|
||||
export const addAlias = async (noteIdOrAlias: string, newAlias: string): Promise<Alias> => {
|
||||
const response = await new PostApiRequestBuilder<Alias, NewAliasDto>('alias', 'alias')
|
||||
const response = await new PostApiRequestBuilder<Alias, NewAliasDto>('alias')
|
||||
.withJsonBody({
|
||||
noteIdOrAlias,
|
||||
newAlias
|
||||
|
@ -35,7 +35,7 @@ export const addAlias = async (noteIdOrAlias: string, newAlias: string): Promise
|
|||
* @throws {Error} when the api request wasn't successfull
|
||||
*/
|
||||
export const markAliasAsPrimary = async (alias: string): Promise<Alias> => {
|
||||
const response = await new PutApiRequestBuilder<Alias, PrimaryAliasDto>('alias/' + alias, 'alias')
|
||||
const response = await new PutApiRequestBuilder<Alias, PrimaryAliasDto>('alias/' + alias)
|
||||
.withJsonBody({
|
||||
primaryAlias: true
|
||||
})
|
||||
|
@ -50,5 +50,5 @@ export const markAliasAsPrimary = async (alias: string): Promise<Alias> => {
|
|||
* @throws {Error} when the api request wasn't successful.
|
||||
*/
|
||||
export const deleteAlias = async (alias: string): Promise<void> => {
|
||||
await new DeleteApiRequestBuilder('alias/' + alias, 'alias').sendRequest()
|
||||
await new DeleteApiRequestBuilder('alias/' + alias).sendRequest()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue