Change schema of url environment variables (#1237)

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2021-05-05 22:33:30 +02:00 committed by GitHub
parent 41e493c8bc
commit a48b4f60bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 33 additions and 33 deletions

View file

@ -10,7 +10,7 @@ import { defaultFetchConfig, expectResponseCode, getApiUrl } from '../utils'
export const INTERACTIVE_LOGIN_METHODS = ['internal', 'ldap', 'openid']
export const doInternalLogin = async (username: string, password: string): Promise<void> => {
const response = await fetch(getApiUrl() + '/auth/internal', {
const response = await fetch(getApiUrl() + 'auth/internal', {
...defaultFetchConfig,
method: 'POST',
body: JSON.stringify({
@ -23,7 +23,7 @@ export const doInternalLogin = async (username: string, password: string): Promi
}
export const doInternalRegister = async (username: string, password: string): Promise<void> => {
const response = await fetch(getApiUrl() + '/auth/register', {
const response = await fetch(getApiUrl() + 'auth/register', {
...defaultFetchConfig,
method: 'POST',
body: JSON.stringify({
@ -40,7 +40,7 @@ export const doInternalRegister = async (username: string, password: string): Pr
}
export const doLdapLogin = async (username: string, password: string): Promise<void> => {
const response = await fetch(getApiUrl() + '/auth/ldap', {
const response = await fetch(getApiUrl() + 'auth/ldap', {
...defaultFetchConfig,
method: 'POST',
body: JSON.stringify({
@ -53,7 +53,7 @@ export const doLdapLogin = async (username: string, password: string): Promise<v
}
export const doOpenIdLogin = async (openId: string): Promise<void> => {
const response = await fetch(getApiUrl() + '/auth/openid', {
const response = await fetch(getApiUrl() + 'auth/openid', {
...defaultFetchConfig,
method: 'POST',
body: JSON.stringify({

View file

@ -8,7 +8,7 @@ import { defaultFetchConfig, expectResponseCode, getApiUrl } from '../utils'
import { Config } from './types'
export const getConfig = async (): Promise<Config> => {
const response = await fetch(getApiUrl() + '/config', {
const response = await fetch(getApiUrl() + 'config', {
...defaultFetchConfig
})
expectResponseCode(response)

View file

@ -8,13 +8,13 @@ import { defaultFetchConfig, expectResponseCode, getApiUrl } from '../utils'
import { HistoryEntryDto, HistoryEntryPutDto, HistoryEntryUpdateDto } from './types'
export const getHistory = async (): Promise<HistoryEntryDto[]> => {
const response = await fetch(getApiUrl() + '/me/history')
const response = await fetch(getApiUrl() + 'me/history')
expectResponseCode(response)
return await response.json() as Promise<HistoryEntryDto[]>
}
export const postHistory = async (entries: HistoryEntryPutDto[]): Promise<void> => {
const response = await fetch(getApiUrl() + '/me/history', {
const response = await fetch(getApiUrl() + 'me/history', {
...defaultFetchConfig,
method: 'POST',
body: JSON.stringify(entries)
@ -23,7 +23,7 @@ export const postHistory = async (entries: HistoryEntryPutDto[]): Promise<void>
}
export const updateHistoryEntryPinStatus = async (noteId: string, entry: HistoryEntryUpdateDto): Promise<void> => {
const response = await fetch(getApiUrl() + '/me/history/' + noteId, {
const response = await fetch(getApiUrl() + 'me/history/' + noteId, {
...defaultFetchConfig,
method: 'PUT',
body: JSON.stringify(entry)
@ -32,7 +32,7 @@ export const updateHistoryEntryPinStatus = async (noteId: string, entry: History
}
export const deleteHistoryEntry = async (noteId: string): Promise<void> => {
const response = await fetch(getApiUrl() + '/me/history/' + noteId, {
const response = await fetch(getApiUrl() + 'me/history/' + noteId, {
...defaultFetchConfig,
method: 'DELETE'
})
@ -40,7 +40,7 @@ export const deleteHistoryEntry = async (noteId: string): Promise<void> => {
}
export const deleteHistory = async (): Promise<void> => {
const response = await fetch(getApiUrl() + '/me/history', {
const response = await fetch(getApiUrl() + 'me/history', {
...defaultFetchConfig,
method: 'DELETE'
})

View file

@ -9,7 +9,7 @@ import { defaultFetchConfig, expectResponseCode, getApiUrl } from '../utils'
import { isMockMode } from '../../utils/test-modes'
export const getMe = async (): Promise<UserResponse> => {
const response = await fetch(getApiUrl() + `/me${ isMockMode() ? '-get' : '' }`, {
const response = await fetch(getApiUrl() + `me${ isMockMode() ? '-get' : '' }`, {
...defaultFetchConfig
})
expectResponseCode(response)
@ -17,7 +17,7 @@ export const getMe = async (): Promise<UserResponse> => {
}
export const updateDisplayName = async (displayName: string): Promise<void> => {
const response = await fetch(getApiUrl() + '/me', {
const response = await fetch(getApiUrl() + 'me', {
...defaultFetchConfig,
method: 'POST',
body: JSON.stringify({
@ -29,7 +29,7 @@ export const updateDisplayName = async (displayName: string): Promise<void> => {
}
export const changePassword = async (oldPassword: string, newPassword: string): Promise<void> => {
const response = await fetch(getApiUrl() + '/me/password', {
const response = await fetch(getApiUrl() + 'me/password', {
...defaultFetchConfig,
method: 'POST',
body: JSON.stringify({
@ -42,7 +42,7 @@ export const changePassword = async (oldPassword: string, newPassword: string):
}
export const deleteUser = async (): Promise<void> => {
const response = await fetch(getApiUrl() + '/me', {
const response = await fetch(getApiUrl() + 'me', {
...defaultFetchConfig,
method: 'DELETE'
})

View file

@ -8,7 +8,7 @@ import { ImageProxyResponse } from '../../components/markdown-renderer/replace-c
import { defaultFetchConfig, expectResponseCode, getApiUrl } from '../utils'
export const getProxiedUrl = async (imageUrl: string): Promise<ImageProxyResponse> => {
const response = await fetch(getApiUrl() + '/media/proxy', {
const response = await fetch(getApiUrl() + 'media/proxy', {
...defaultFetchConfig,
method: 'POST',
body: JSON.stringify({
@ -24,7 +24,7 @@ export interface UploadedMedia {
}
export const uploadFile = async (noteId: string, contentType: string, media: Blob): Promise<UploadedMedia> => {
const response = await fetch(getApiUrl() + '/media/upload', {
const response = await fetch(getApiUrl() + 'media/upload', {
...defaultFetchConfig,
headers: {
'Content-Type': contentType,

View file

@ -11,7 +11,7 @@ import { isMockMode } from '../../utils/test-modes'
export const getNote = async (noteId: string): Promise<NoteDto> => {
// The "-get" suffix is necessary, because in our mock api (filesystem) the note id might already be a folder.
// TODO: [mrdrogdrog] replace -get with actual api route as soon as api backend is ready.
const response = await fetch(getApiUrl() + `/notes/${ noteId }${ isMockMode() ? '-get' : '' }`, {
const response = await fetch(getApiUrl() + `notes/${ noteId }${ isMockMode() ? '-get' : '' }`, {
...defaultFetchConfig
})
expectResponseCode(response)
@ -19,7 +19,7 @@ export const getNote = async (noteId: string): Promise<NoteDto> => {
}
export const deleteNote = async (noteId: string): Promise<void> => {
const response = await fetch(getApiUrl() + `/notes/${ noteId }`, {
const response = await fetch(getApiUrl() + `notes/${ noteId }`, {
...defaultFetchConfig,
method: 'DELETE'
})

View file

@ -15,7 +15,7 @@ export const getRevision = async (noteId: string, timestamp: number): Promise<Re
if (revisionCache.has(cacheKey)) {
return revisionCache.get(cacheKey)
}
const response = await fetch(getApiUrl() + `/notes/${ noteId }/revisions/${ timestamp }`, {
const response = await fetch(getApiUrl() + `notes/${ noteId }/revisions/${ timestamp }`, {
...defaultFetchConfig
})
expectResponseCode(response)
@ -26,7 +26,7 @@ export const getRevision = async (noteId: string, timestamp: number): Promise<Re
export const getAllRevisions = async (noteId: string): Promise<RevisionListEntry[]> => {
// TODO Change 'revisions-list' to 'revisions' as soon as the backend is ready to serve some data!
const response = await fetch(getApiUrl() + `/notes/${ noteId }/revisions-list`, {
const response = await fetch(getApiUrl() + `notes/${ noteId }/revisions-list`, {
...defaultFetchConfig
})
expectResponseCode(response)

View file

@ -8,7 +8,7 @@ import { defaultFetchConfig, expectResponseCode, getApiUrl } from '../utils'
import { AccessToken, AccessTokenSecret } from './types'
export const getAccessTokenList = async (): Promise<AccessToken[]> => {
const response = await fetch(`${ getApiUrl() }/tokens`, {
const response = await fetch(`${ getApiUrl() }tokens`, {
...defaultFetchConfig
})
expectResponseCode(response)
@ -16,7 +16,7 @@ export const getAccessTokenList = async (): Promise<AccessToken[]> => {
}
export const postNewAccessToken = async (label: string): Promise<AccessToken & AccessTokenSecret> => {
const response = await fetch(`${ getApiUrl() }/tokens`, {
const response = await fetch(`${ getApiUrl() }tokens`, {
...defaultFetchConfig,
method: 'POST',
body: label
@ -26,7 +26,7 @@ export const postNewAccessToken = async (label: string): Promise<AccessToken & A
}
export const deleteAccessToken = async (timestamp: number): Promise<void> => {
const response = await fetch(`${ getApiUrl() }/tokens/${ timestamp }`, {
const response = await fetch(`${ getApiUrl() }tokens/${ timestamp }`, {
...defaultFetchConfig,
method: 'DELETE'
})