as you can see from the title I am a newbie so trying to learn everyday. I have found the following code witch works and fetches the data from an URL, I don't have an URL to fetch them from but a supabase database. Heres how we get the data.
fetch('https://gw.alipayobjects.com/os/antvdemo/assets/data/algorithm-category.json')
.then((res) => res.json())
.then((data) => {
const container = document.getElementById('container');
const width = container.scrollWidth;
const height = container.scrollHeight || 700;
const graph = new G6.TreeGraph({
container: 'container',
width,
height,
modes: {
default: [
{
type: 'collapse-expand',
onChange: function onChange(item, collapsed) {
const data = item.get('model');
data.collapsed = collapsed;
return true;
}
},
'drag-canvas',
'zoom-canvas'
]
},
...
How can I make it so that the data works as an array, because the database doesnt return them like that.Please let me know your how I can workaround this