| 278 | |
| 279 | // Fetch the VueFlow graph |
| 280 | export async function fetchVueGraph(key) { |
| 281 | try { |
| 282 | const response = await fetch(apiUrl(`/api/vuegraphs/${encodeURIComponent(key)}`)) |
| 283 | const data = await response.json().catch(() => ({})) |
| 284 | |
| 285 | if (response.ok) { |
| 286 | return { |
| 287 | success: true, |
| 288 | content: data?.content, |
| 289 | status: response.status |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | return { |
| 294 | success: false, |
| 295 | status: response.status, |
| 296 | detail: data?.detail, |
| 297 | message: data?.message || 'Failed to fetch VueFlow graph' |
| 298 | } |
| 299 | } catch (error) { |
| 300 | console.error('Error fetching VueFlow graph:', error) |
| 301 | return { |
| 302 | success: false, |
| 303 | message: 'API error' |
| 304 | } |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | // Save the VueFlow graph |
| 309 | export async function postVuegraphs({ filename, content }) { |