Mark as required on subsequent selections

This commit is contained in:
Iván Ovejero 2022-05-02 18:03:30 +02:00
parent 452139f7ec
commit 9b3e9a27b5

View file

@ -204,17 +204,23 @@ export const nodeHelpers = mixins(
let credentialDisplayName: string;
let selectedCredentials: INodeCredentialsDetails;
const { authenticateWith, genericAuthType, nodeCredentialType } = node.parameters as {
authenticateWith: 'none' | 'genericAuth' | 'nodeCredential';
genericAuthType: string;
nodeCredentialType: string;
};
if (
node.type === HTTP_REQUEST_NODE_TYPE &&
node.typeVersion === 2 &&
node.parameters.authenticateWith === 'genericAuth' &&
node.credentials === undefined // @TODO Or if no currently selected generic auth cred
authenticateWith === 'genericAuth' &&
(
node.credentials === undefined ||
Object.keys(node.credentials).includes(genericAuthType) === false
)
) {
const { genericAuthType } = node.parameters as { genericAuthType: string };
const credentialType = this.getCredentialTypeByName(genericAuthType);
//
return {
credentials: {
[credentialType.name]: [`Credentials for "${credentialType.displayName}" are not set.`],
@ -225,13 +231,13 @@ export const nodeHelpers = mixins(
if (
node.type === HTTP_REQUEST_NODE_TYPE &&
node.typeVersion === 2 &&
node.parameters.authenticateWith === 'nodeCredential' &&
node.credentials === undefined // @TODO or if no currently selected service-specific cred
authenticateWith === 'nodeCredential' &&
nodeCredentialType !== '' &&
(
node.credentials === undefined ||
Object.keys(node.credentials).includes(nodeCredentialType) === false
)
) {
const { nodeCredentialType } = node.parameters as { nodeCredentialType?: string };
if (!nodeCredentialType) return null;
const credentialType = this.getCredentialTypeByName(nodeCredentialType);
return {