Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

226
Views
Get data from database not fetch from url

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

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!