mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
replace location only on waiting forms
This commit is contained in:
parent
293128230b
commit
75ab8988d9
|
@ -1,7 +1,12 @@
|
||||||
import { Service } from '@n8n/di';
|
import { Service } from '@n8n/di';
|
||||||
import type express from 'express';
|
import type express from 'express';
|
||||||
import type { IRunData } from 'n8n-workflow';
|
import type { IRunData } from 'n8n-workflow';
|
||||||
import { FORM_NODE_TYPE, WAITING_FORMS_EXECUTION_STATUS, Workflow } from 'n8n-workflow';
|
import {
|
||||||
|
FORM_NODE_TYPE,
|
||||||
|
WAIT_NODE_TYPE,
|
||||||
|
WAITING_FORMS_EXECUTION_STATUS,
|
||||||
|
Workflow,
|
||||||
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import { ConflictError } from '@/errors/response-errors/conflict.error';
|
import { ConflictError } from '@/errors/response-errors/conflict.error';
|
||||||
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
import { NotFoundError } from '@/errors/response-errors/not-found.error';
|
||||||
|
@ -74,8 +79,19 @@ export class WaitingForms extends WaitingWebhooks {
|
||||||
|
|
||||||
const execution = await this.getExecution(executionId);
|
const execution = await this.getExecution(executionId);
|
||||||
|
|
||||||
if (suffix === WAITING_FORMS_EXECUTION_STATUS) {
|
if (execution && suffix === WAITING_FORMS_EXECUTION_STATUS) {
|
||||||
res.send(execution?.status ?? null);
|
let status: string = execution?.status;
|
||||||
|
const { node } = execution.data.executionData?.nodeExecutionStack[0] ?? {};
|
||||||
|
|
||||||
|
if (node && status === 'waiting') {
|
||||||
|
if (node.type === FORM_NODE_TYPE) {
|
||||||
|
status = 'form-waiting';
|
||||||
|
}
|
||||||
|
if (node.type === WAIT_NODE_TYPE && node.parameters.resume === 'form') {
|
||||||
|
status = 'form-waiting';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res.send(status ?? null);
|
||||||
return { noWebhookResponse: true };
|
return { noWebhookResponse: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -779,7 +779,7 @@
|
||||||
const response = await fetch(`${formWaitingUrl ?? window.location.href}/n8n-execution-status`);
|
const response = await fetch(`${formWaitingUrl ?? window.location.href}/n8n-execution-status`);
|
||||||
const text = (await response.text()).trim();
|
const text = (await response.text()).trim();
|
||||||
|
|
||||||
if (text === "waiting") {
|
if (text === "form-waiting") {
|
||||||
window.location.replace(formWaitingUrl ?? window.location.href);
|
window.location.replace(formWaitingUrl ?? window.location.href);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue