Show workflow templates from custom nodes (#2032)

This commit is contained in:
Zoltán Dócs
2024-12-30 04:26:03 +01:00
committed by GitHub
parent 92a5a8057f
commit 5218024395
5 changed files with 237 additions and 59 deletions

View File

@@ -0,0 +1,30 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { api } from '@/scripts/api'
export const useWorkflowTemplatesStore = defineStore(
'workflowTemplates',
() => {
const items = ref<{
[customNodesName: string]: string[]
}>({})
const isLoaded = ref(false)
async function loadWorkflowTemplates() {
try {
if (!isLoaded.value) {
items.value = await api.getWorkflowTemplates()
isLoaded.value = true
}
} catch (error) {
console.error('Error fetching workflow templates:', error)
}
}
return {
items,
isLoaded,
loadWorkflowTemplates
}
}
)