mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-14 07:04:45 -04:00
added redirector component (#199)
* added redirector component * it will redirect every request to /$something that is not handled otherwise (/intro, /login and such) to /n/$something * added getNote API Call * added NotFound component * added LandingLayout around the NotFound component, so users can easily navigate away from the component Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
773fc60f07
commit
c679f5524c
5 changed files with 85 additions and 0 deletions
|
@ -1,6 +1,29 @@
|
|||
import { expectResponseCode, getBackendUrl } from '../utils/apiUtils'
|
||||
import { defaultFetchConfig } from './default'
|
||||
|
||||
interface LastChange {
|
||||
userId: string
|
||||
username: string
|
||||
timestamp: number
|
||||
}
|
||||
|
||||
export interface Note {
|
||||
id: string
|
||||
alias: string
|
||||
lastChange: LastChange
|
||||
viewcount: number
|
||||
createtime: string
|
||||
content: string
|
||||
authorship: number[]
|
||||
preVersionTwoNote: boolean
|
||||
}
|
||||
|
||||
export const getNote = async (noteId: string): Promise<Note> => {
|
||||
const response = await fetch(getBackendUrl() + `/notes/${noteId}`)
|
||||
expectResponseCode(response)
|
||||
return await response.json() as Promise<Note>
|
||||
}
|
||||
|
||||
export const deleteNote = async (noteId: string): Promise<void> => {
|
||||
const response = await fetch(getBackendUrl() + `/notes/${noteId}`, {
|
||||
...defaultFetchConfig,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue