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

    frubalu

    07/27/2021, 6:10 PM
    whats your insert look like?
  • f

    Flyken

    07/27/2021, 6:11 PM
    i don't have an insert
  • f

    Flyken

    07/27/2021, 6:11 PM
    im doing it manually rn
  • f

    frubalu

    07/27/2021, 6:12 PM
    oh is this the same query?
  • f

    Flyken

    07/27/2021, 6:12 PM
    yea
  • f

    Flyken

    07/27/2021, 6:12 PM
    huh
  • f

    Flyken

    07/27/2021, 6:12 PM
    i removed the second row
  • f

    Flyken

    07/27/2021, 6:12 PM
    and it works
  • h

    hips

    07/27/2021, 6:12 PM
    ?
  • f

    Flyken

    07/27/2021, 6:13 PM
    @User i don't know what it means
  • f

    Flyken

    07/27/2021, 6:13 PM
    but yea, removed the second entry and it works now
  • h

    hips

    07/27/2021, 6:13 PM
    do you know what an integer is?
  • f

    Flyken

    07/27/2021, 6:14 PM
    yes
  • h

    hips

    07/27/2021, 6:15 PM
    ¯\_(ツ)_/¯
  • f

    Flyken

    07/27/2021, 6:16 PM
    Copy code
    js
    const gameList = await supabase.from('games').select('*').eq('id', res.data.map(g => g.game_id));
              console.log(gameList);
              if(gameList) setGames(gameList.data);
    is this right?
  • f

    Flyken

    07/27/2021, 6:16 PM
    OH
  • f

    Flyken

    07/27/2021, 6:16 PM
    I SEEE
  • f

    frubalu

    07/27/2021, 6:16 PM
    yep haha
  • f

    frubalu

    07/27/2021, 6:17 PM
    i mean, no it's not right. but it sounds like you understand
  • l

    Lio

    07/27/2021, 6:18 PM
    .contains('id', res.data.map(g => g.game_id))
    ?
  • f

    Flyken

    07/27/2021, 6:18 PM
    yea it has to do with my games query now
  • f

    frubalu

    07/27/2021, 6:19 PM
    the equal method should only be equal to one value
  • f

    frubalu

    07/27/2021, 6:19 PM
    otherwise you could try something like the
    .or()
    filter
  • f

    Flyken

    07/27/2021, 6:19 PM
    yea
  • f

    Flyken

    07/27/2021, 6:19 PM
    theres logic that i need ot hink about in a minute
  • f

    frubalu

    07/27/2021, 6:54 PM
    ok i have an interesting issue. does anyone know why a session would return null, even after login? somehow session isn't being set. The way I log in is a little messy, but here's what I've got: In my LoginForm, I call this method:
    Copy code
    const { data, errors } = await signIn(credentials, provider);
    This is a method that i have available on a user context:
    Copy code
    signIn: async (credentials: any, provider: Provider) => {
          const { data, errors } = await loginMutation({
            variables: {
              input: {
                email: credentials?.email as string,
                password: credentials?.password as string,
                provider,
              },
            },
          });
    
          return { data, errors };
        },
    This calls a GraphQL resolver, which runs this method:
    Copy code
    const { data, error } = await supabase.auth.signIn({ email, password });
    All of my data returns correctly, no errors, and I'm pushed correctly to the index inside of the application. But if I run something like this inside of my user context, session and user are never set:
    Copy code
    useEffect(() => {
        const session = supabase.auth.session();
        console.log({ session });
        setSession(session);
        setUser(session?.user ?? null);
        const { data: authListener } = supabase.auth.onAuthStateChange(
          async (event, session) => {
            console.log({ event });
            console.log({ session });
            setSession(session);
            setUser(session?.user ?? null);
          }
        );
    
        return () => {
          authListener?.unsubscribe();
        };
      }, []);
  • f

    frubalu

    07/27/2021, 6:56 PM
    any ideas? is it because I am trying to signin via the backend of my app as opposed to running the signin method on the frontend?
  • y

    YelloJello

    07/27/2021, 6:59 PM
    dunno a lot about GraphQL, but does your resolver run on the server side?
  • f

    frubalu

    07/27/2021, 7:00 PM
    yep, it's running inside of the NextJS pages/api directory
  • y

    YelloJello

    07/27/2021, 7:00 PM
    how would signing in work on the server side?
1...678...316Latest