mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-20 18:25:21 -04:00
Add prettier for codestyle and re-format everything (#1294)
This commit is contained in:
parent
8b78154075
commit
0aae1f70d2
319 changed files with 4809 additions and 3936 deletions
|
@ -11,24 +11,24 @@ import { Revision, RevisionListEntry } from './types'
|
|||
const revisionCache = new Cache<string, Revision>(3600)
|
||||
|
||||
export const getRevision = async (noteId: string, timestamp: number): Promise<Revision> => {
|
||||
const cacheKey = `${ noteId }:${ timestamp }`
|
||||
const cacheKey = `${noteId}:${timestamp}`
|
||||
if (revisionCache.has(cacheKey)) {
|
||||
return revisionCache.get(cacheKey)
|
||||
}
|
||||
const response = await fetch(getApiUrl() + `notes/${ noteId }/revisions/${ timestamp }`, {
|
||||
const response = await fetch(getApiUrl() + `notes/${noteId}/revisions/${timestamp}`, {
|
||||
...defaultFetchConfig
|
||||
})
|
||||
expectResponseCode(response)
|
||||
const revisionData = await response.json() as Revision
|
||||
const revisionData = (await response.json()) as Revision
|
||||
revisionCache.put(cacheKey, revisionData)
|
||||
return revisionData
|
||||
}
|
||||
|
||||
export const getAllRevisions = async (noteId: string): Promise<RevisionListEntry[]> => {
|
||||
// TODO Change 'revisions-list' to 'revisions' as soon as the backend is ready to serve some data!
|
||||
const response = await fetch(getApiUrl() + `notes/${ noteId }/revisions-list`, {
|
||||
const response = await fetch(getApiUrl() + `notes/${noteId}/revisions-list`, {
|
||||
...defaultFetchConfig
|
||||
})
|
||||
expectResponseCode(response)
|
||||
return await response.json() as Promise<RevisionListEntry[]>
|
||||
return (await response.json()) as Promise<RevisionListEntry[]>
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue