https://supabase.com/ logo
Join DiscordCommunities
Powered by
# help
  • y

    YelloJello

    07/27/2021, 7:25 PM
    worth reporting then i'd say
  • s

    sumchans

    07/27/2021, 7:25 PM
    This is the message I get An invalid response was received from the upstream server
  • f

    Flyken

    07/27/2021, 7:34 PM

    https://i.imgur.com/1Gn2XF0.png▾

  • f

    Flyken

    07/27/2021, 7:35 PM
    Copy code
    js
      useEffect(() => {
        if (user) {
          (async () => {
            const res = await fetchGames();
            const {data: gameList, error} = await supabase.from('games').select('*')
            if(res) {
              res.data.map(game => {
                gameList.map((Game) => {
                  if(Game.id == game.game_id) {
                    setGames(game)
                  }
                })
              })
            }
         })();
        }
      }, [user]);
    
      console.log(games)
  • f

    Flyken

    07/27/2021, 7:35 PM
    am i stupid?
  • y

    YelloJello

    07/27/2021, 7:35 PM
    what's the problem
  • f

    Flyken

    07/27/2021, 7:36 PM
    wait
  • f

    Flyken

    07/27/2021, 7:36 PM
    i figured it out
  • f

    Flyken

    07/27/2021, 7:37 PM
    ok
  • f

    Flyken

    07/27/2021, 7:37 PM
    so its returning right now
  • f

    Flyken

    07/27/2021, 7:37 PM
    but its not an array
  • f

    Flyken

    07/27/2021, 7:38 PM
    wait
  • f

    Flyken

    07/27/2021, 7:38 PM
    wtf is going on
  • f

    Flyken

    07/27/2021, 7:38 PM
    my brain hurts D:
  • f

    Flyken

    07/27/2021, 7:39 PM
    im trying to get the games that match the id in the stuff we returned before
  • f

    Flyken

    07/27/2021, 7:39 PM
    so i have this
  • f

    Flyken

    07/27/2021, 7:39 PM
    this is good
  • f

    frubalu

    07/27/2021, 7:40 PM
    looks like you're running
    setGames(game)
    , which is overwriting it each time there's a match
  • f

    Flyken

    07/27/2021, 7:40 PM
    what i need to do is grab
    games
    table, and return in an array of games that match
    game_id
  • f

    Flyken

    07/27/2021, 7:40 PM
    see what i mean?
  • f

    frubalu

    07/27/2021, 7:40 PM
    you could run a
    .match()
    ?
  • f

    frubalu

    07/27/2021, 7:41 PM
    https://supabase.io/docs/reference/javascript/match
  • f

    frubalu

    07/27/2021, 7:41 PM
    Copy code
    const { data, error } = await supabase.from('games').select().match({ id: gameId })
  • f

    frubalu

    07/27/2021, 7:41 PM
    something like that
  • f

    Flyken

    07/27/2021, 7:41 PM
    let me try
  • f

    Flyken

    07/27/2021, 7:43 PM
    Copy code
    js
    if(res) {
              res.data.map(game => {
                //console.log(game)
                (async () => {
                const { data, error } = await supabase.from('games').select().match({ id: game.game_id })
                if(data){
                  console.log(data)
                }
                })
              })
            }
    like this?
  • f

    frubalu

    07/27/2021, 7:44 PM
    so
    res
    returns all of a specific user's games from the
    users_games
    table, right?
  • f

    frubalu

    07/27/2021, 7:44 PM
    on that join table we created earlier
  • f

    Flyken

    07/27/2021, 7:45 PM
    yea
  • f

    frubalu

    07/27/2021, 7:45 PM
    then you're wanting to get games table information for each of those
1...8910...316Latest