Detect active credential type

This commit is contained in:
Iván Ovejero 2022-05-03 17:38:05 +02:00
parent 4997569eb2
commit 64e08c8fdd
3 changed files with 7 additions and 7 deletions

View file

@ -145,6 +145,7 @@ export interface INodeUi extends INode {
notes?: string;
issues?: INodeIssues;
name: string;
activeCredentialType?: string;
}
export interface INodeTypesMaxCount {

View file

@ -216,6 +216,8 @@ export default mixins(
},
};
delete this.node.activeCredentialType;
this.$emit('credentialSelected', updateInformation);
},
@ -272,6 +274,8 @@ export default mixins(
},
};
this.node.activeCredentialType = credentialType;
this.$emit('credentialSelected', updateInformation);
},

View file

@ -601,14 +601,9 @@ export default mixins(
* Whether the node's credential may be used to make a request with the HTTP Request node.
*/
isSupportedByHttpRequestNode(): boolean {
if (!this.node || !this.node.credentials) return false;
if (!this.node || !this.node.activeCredentialType || !this.node.credentials) return false;
// @TODO Detect currently selected cred
const selectedCredentialTypeName = Object.keys(this.node.credentials);
if (!selectedCredentialTypeName.length) return false;
const name = selectedCredentialTypeName.pop()!;
const credentialType = this.getCredentialTypeByName(name);
const credentialType = this.getCredentialTypeByName(this.node.activeCredentialType);
return (
credentialType.name.slice(0, -4).endsWith('OAuth') ||