mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 09:45:37 -04:00
Adapt react-client to use the real backend API (#1545)
Co-authored-by: Philip Molares <philip.molares@udo.edu> Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
3399ed2023
commit
26f90505ff
227 changed files with 4726 additions and 2310 deletions
|
@ -1,34 +1,14 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { defaultFetchConfig, expectResponseCode, getApiUrl } from '../utils'
|
||||
|
||||
export const INTERACTIVE_LOGIN_METHODS = ['local', 'ldap']
|
||||
|
||||
export enum AuthError {
|
||||
INVALID_CREDENTIALS = 'invalidCredentials',
|
||||
LOGIN_DISABLED = 'loginDisabled',
|
||||
OPENID_ERROR = 'openIdError',
|
||||
OTHER = 'other'
|
||||
}
|
||||
|
||||
export enum RegisterError {
|
||||
USERNAME_EXISTING = 'usernameExisting',
|
||||
REGISTRATION_DISABLED = 'registrationDisabled',
|
||||
OTHER = 'other'
|
||||
}
|
||||
import { DeleteApiRequestBuilder } from '../common/api-request-builder/delete-api-request-builder'
|
||||
|
||||
/**
|
||||
* Requests to logout the current user.
|
||||
* Requests to log out the current user.
|
||||
* @throws Error if logout is not possible.
|
||||
*/
|
||||
export const doLogout = async (): Promise<void> => {
|
||||
const response = await fetch(getApiUrl() + 'auth/logout', {
|
||||
...defaultFetchConfig,
|
||||
method: 'DELETE'
|
||||
})
|
||||
|
||||
expectResponseCode(response)
|
||||
await new DeleteApiRequestBuilder('auth/logout').sendRequest()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue