mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-05 17:14:40 -04:00
Fix Communication between frontend and backend (#1201)
Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de> Signed-off-by: Philip Molares <philip.molares@udo.edu> Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
4a18e51c83
commit
9cf7980334
38 changed files with 268 additions and 164 deletions
|
@ -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() + '/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() + '/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() + '/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() + '/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() + '/history', {
|
||||
const response = await fetch(getApiUrl() + '/me/history', {
|
||||
...defaultFetchConfig,
|
||||
method: 'DELETE'
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue