🐛 api now waits for all connected inputs to have value
This commit is contained in:
@@ -84,7 +84,7 @@ export default class Api extends Node<typeof inputs, typeof outputs> {
|
||||
}
|
||||
|
||||
async _update() {
|
||||
if (!this.in.url.value) {
|
||||
if (!this.canUpdate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,6 +102,31 @@ export default class Api extends Node<typeof inputs, typeof outputs> {
|
||||
}
|
||||
}
|
||||
|
||||
private canUpdate(): boolean {
|
||||
if (!this.in.url.value) {
|
||||
return false
|
||||
}
|
||||
|
||||
const inputs = [
|
||||
'image0',
|
||||
'image1',
|
||||
'image2',
|
||||
'image3',
|
||||
'image4',
|
||||
'image5',
|
||||
'image6',
|
||||
'image7',
|
||||
]
|
||||
|
||||
for(const input of inputs) {
|
||||
if (this.in[input].output && !this.in[input].value) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private async upload(): Promise<HTMLImageElement | undefined> {
|
||||
const formData = await this.createFormData();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user