New note creation (#1998)

* Add new note page

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Make new note button clickable

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Add CHANGELOG note

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Refactor error messages

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Use features note in mock

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Common Error page should always use i18n

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson 2022-05-02 17:39:18 +02:00 committed by GitHub
parent 1fa94f9ea6
commit 85eff24be1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 178 additions and 37 deletions

View file

@ -0,0 +1,59 @@
/*
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { NextApiRequest, NextApiResponse } from 'next'
import { HttpMethod, respondToMatchingRequest } from '../../../../../handler-utils/respond-to-matching-request'
import type { Note } from '../../../../../api/notes/types'
const handler = (req: NextApiRequest, res: NextApiResponse): void => {
respondToMatchingRequest<Note>(
HttpMethod.POST,
req,
res,
{
content: 'new note content',
metadata: {
id: 'featuresId',
version: 2,
viewCount: 0,
updatedAt: '2021-04-24T09:27:51.000Z',
createdAt: '2021-04-24T09:27:51.000Z',
updateUsername: null,
primaryAddress: 'features',
editedBy: [],
title: 'New note',
tags: ['hedgedoc', 'demo', 'react'],
description: 'Many features, such wow!',
aliases: [
{
name: 'features',
primaryAlias: true,
noteId: 'featuresId'
}
],
permissions: {
owner: 'tilman',
sharedToUsers: [
{
username: 'molly',
canEdit: true
}
],
sharedToGroups: [
{
groupName: '_LOGGED_IN',
canEdit: false
}
]
}
},
editedByAtPosition: []
},
201
)
}
export default handler