Fix preview delay on Web by sending a dummy file.
This commit is contained in:
parent
92b211dd94
commit
985aada5e4
1 changed files with 9 additions and 3 deletions
|
@ -16,18 +16,24 @@ export default function apiPublishCallViaWeb(
|
|||
connectionString: string,
|
||||
token: string,
|
||||
method: string,
|
||||
params: { file_path: string },
|
||||
params: { file_path: string, preview: boolean },
|
||||
resolve: Function,
|
||||
reject: Function
|
||||
) {
|
||||
const { file_path: filePath } = params;
|
||||
const { file_path: filePath, preview } = params;
|
||||
|
||||
if (!filePath) {
|
||||
return apiCall(method, params, resolve, reject);
|
||||
}
|
||||
|
||||
const counter = new Date().getTime();
|
||||
const fileField = filePath;
|
||||
let fileField = filePath;
|
||||
|
||||
if (preview) {
|
||||
// Send dummy file for the preview. The tx-fee calculation does not depend on it.
|
||||
const dummyContent = 'x';
|
||||
fileField = new File([dummyContent], 'dummy.md', { type: 'text/markdown' });
|
||||
}
|
||||
|
||||
// Putting a dummy value here, the server is going to process the POSTed file
|
||||
// and set the file_path itself
|
||||
|
|
Loading…
Reference in a new issue