Add image placeholder and upload indicating frame (#1666)

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
Co-authored-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Tilman Vatteroth 2021-12-11 15:34:33 +01:00 committed by GitHub
parent 58fecc0b3a
commit d4251519e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 908 additions and 72 deletions

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { isMockMode } from '../../utils/test-modes'
import { isMockMode, isTestMode } from '../../utils/test-modes'
import { defaultFetchConfig, expectResponseCode, getApiUrl } from '../utils'
export interface ImageProxyResponse {
@ -37,6 +37,13 @@ export const uploadFile = async (noteId: string, media: Blob): Promise<UploadedM
method: isMockMode() ? 'GET' : 'POST',
body: isMockMode() ? undefined : media
})
if (isMockMode() && !isTestMode()) {
await new Promise((resolve) => {
setTimeout(resolve, 3000)
})
}
expectResponseCode(response, isMockMode() ? 200 : 201)
return (await response.json()) as Promise<UploadedMedia>
}