mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 17:55:17 -04:00
feat: migrate frontend app to nextjs app router
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
5b5dabc84e
commit
8602645bea
108 changed files with 893 additions and 1188 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder'
|
||||
import type { FrontendConfig } from './types'
|
||||
import { isBuildTime } from '../../utils/test-modes'
|
||||
|
||||
/**
|
||||
* Fetches the frontend config from the backend.
|
||||
|
@ -12,7 +13,10 @@ import type { FrontendConfig } from './types'
|
|||
* @return The frontend config.
|
||||
* @throws {Error} when the api request wasn't successful.
|
||||
*/
|
||||
export const getConfig = async (baseUrl?: string): Promise<FrontendConfig> => {
|
||||
export const getConfig = async (baseUrl?: string): Promise<FrontendConfig | undefined> => {
|
||||
if (isBuildTime) {
|
||||
return undefined
|
||||
}
|
||||
const response = await new GetApiRequestBuilder<FrontendConfig>('config', baseUrl).sendRequest()
|
||||
return response.asParsedJsonObject()
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ import type { Note, NoteDeletionOptions, NoteMetadata } from './types'
|
|||
* @return Content and metadata of the specified note.
|
||||
* @throws {Error} when the api request wasn't successful.
|
||||
*/
|
||||
export const getNote = async (noteIdOrAlias: string): Promise<Note> => {
|
||||
const response = await new GetApiRequestBuilder<Note>('notes/' + noteIdOrAlias).sendRequest()
|
||||
export const getNote = async (noteIdOrAlias: string, baseUrl?: string): Promise<Note> => {
|
||||
const response = await new GetApiRequestBuilder<Note>('notes/' + noteIdOrAlias, baseUrl).sendRequest()
|
||||
return response.asParsedJsonObject()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue