hedgedoc/src/pages/api/mock-backend/private/tokens.ts
Erik Michelson 26f90505ff
Adapt react-client to use the real backend API (#1545)
Co-authored-by: Philip Molares <philip.molares@udo.edu>
Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de>
2022-04-15 23:03:15 +02:00

29 lines
896 B
TypeScript

/*
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import type { NextApiRequest, NextApiResponse } from 'next'
import type { AccessToken } from '../../../../api/tokens/types'
import { HttpMethod, respondToMatchingRequest } from '../../../../handler-utils/respond-to-matching-request'
const handler = (req: NextApiRequest, res: NextApiResponse) => {
respondToMatchingRequest<AccessToken[]>(HttpMethod.GET, req, res, [
{
label: 'Demo-App',
keyId: 'demo',
createdAt: '2021-11-20T23:54:13+01:00',
lastUsedAt: '2021-11-20T23:54:13+01:00',
validUntil: '2022-11-20'
},
{
label: 'CLI @ Test-PC',
keyId: 'cli',
createdAt: '2021-11-20T23:54:13+01:00',
lastUsedAt: '2021-11-20T23:54:13+01:00',
validUntil: '2021-11-20'
}
])
}
export default handler