Add prettier for codestyle and re-format everything (#1294)

This commit is contained in:
Erik Michelson 2021-06-06 23:14:00 +02:00 committed by GitHub
parent 8b78154075
commit 0aae1f70d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
319 changed files with 4809 additions and 3936 deletions

View file

@ -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[]>
}