| 307 | |
| 308 | // Save the VueFlow graph |
| 309 | export async function postVuegraphs({ filename, content }) { |
| 310 | try { |
| 311 | const response = await fetch(apiUrl('/api/vuegraphs/upload/content'), { |
| 312 | method: 'POST', |
| 313 | headers: { |
| 314 | 'Content-Type': 'application/json', |
| 315 | }, |
| 316 | body: JSON.stringify({ |
| 317 | filename, |
| 318 | content |
| 319 | }) |
| 320 | }) |
| 321 | |
| 322 | const data = await response.json().catch(() => ({})) |
| 323 | |
| 324 | if (response.ok) { |
| 325 | return { |
| 326 | success: true, |
| 327 | message: data?.message || 'VueFlow graph saved successfully' |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | return { |
| 332 | success: false, |
| 333 | status: response.status, |
| 334 | detail: data?.detail, |
| 335 | message: data?.message || 'Failed to save VueFlow graph' |
| 336 | } |
| 337 | } catch (error) { |
| 338 | console.error('Error saving VueFlow graph:', error) |
| 339 | return { |
| 340 | success: false, |
| 341 | message: 'API error' |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | // Fetch the config schema |
| 347 | export async function fetchConfigSchema(breadcrumbs) { |