mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-28 22:15:12 -04:00
fix: Move content into to frontend directory
Doing this BEFORE the merge prevents a lot of merge conflicts. Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
4e18ce38f3
commit
762a0a850e
1051 changed files with 0 additions and 35 deletions
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import type { NextPage } from 'next'
|
||||
import { useSingleStringUrlParameter } from '../hooks/common/use-single-string-url-parameter'
|
||||
import { useAsync } from 'react-use'
|
||||
import { createNote } from '../api/notes'
|
||||
import { AsyncLoadingBoundary } from '../components/common/async-loading-boundary'
|
||||
import { Redirect } from '../components/common/redirect'
|
||||
import { CommonErrorPage } from '../components/error-pages/common-error-page'
|
||||
|
||||
/**
|
||||
* Creates a new note, optionally including the passed content and redirects to that note.
|
||||
*/
|
||||
export const NewNotePage: NextPage = () => {
|
||||
const newContent = useSingleStringUrlParameter('content', '')
|
||||
|
||||
const { loading, error, value } = useAsync(() => {
|
||||
return createNote(newContent)
|
||||
}, [newContent])
|
||||
|
||||
return (
|
||||
<AsyncLoadingBoundary
|
||||
loading={loading}
|
||||
componentName={'NewNotePage'}
|
||||
error={error}
|
||||
errorComponent={
|
||||
<CommonErrorPage
|
||||
titleI18nKey={'errors.noteCreationFailed.title'}
|
||||
descriptionI18nKey={'errors.noteCreationFailed.description'}
|
||||
/>
|
||||
}>
|
||||
{value ? <Redirect to={`/n/${value.metadata.primaryAddress}`} /> : null}
|
||||
</AsyncLoadingBoundary>
|
||||
)
|
||||
}
|
||||
|
||||
export default NewNotePage
|
Loading…
Add table
Add a link
Reference in a new issue