Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

228
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda