mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 01:35:18 -04:00
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:
parent
58fecc0b3a
commit
d4251519e2
37 changed files with 908 additions and 72 deletions
|
@ -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>
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue