regex
02/05/2022, 8:40 PMexport default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
const user = await supabase.auth.user();
const { data, error, status } = await supabase
.from("profiles")
.select(`username, country, avatar_url`)
.eq("id", user?.id)
.single();
if (error) return res.status(status).json({ error: error.message });
return res.status(200).json({ user: data });
}
However, I am getting an error response error: "invalid input syntax for type uuid: \"undefined\""
Can't I reach logged in user's id inside the API folder?garyaustin
02/05/2022, 9:12 PMEryou Hao
02/06/2022, 8:12 AMhotbelgo
02/06/2022, 10:26 AMexport async function signUp(credentials: Credentials, name: String): Promise<Player> {
// Create the user
let userRes = await supabase.auth.signUp(credentials);
console.log("signUp", userRes)
if (userRes.error) return Promise.reject(userRes.error);
// Create and insert a Player
const newPlayer = {
user_id: userRes.user.id,
name
}
// insert takes a list
const { data, error } = await supabase.from(PLAYERS).insert([newPlayer])
if (error) return Promise.reject(error)
return data[0]
}
And setup Select and Insert RLS with (role() = 'authenticated'::text)
But I get an RLS error about creating new playeranggoran
02/06/2022, 10:57 AMjoshcowan25
02/06/2022, 11:00 AMjoshcowan25
02/06/2022, 11:03 AManggoran
02/06/2022, 11:27 AMosaxma
02/06/2022, 12:14 PMtext
cannot be implicitly casted to text[]
. If your table is empty and does not have data, just drop the column and add it again with the new type. Otherwise, if you need to cast existing data from text
to text[]
you can write a query that uses string_to_array(value_from_column, delimiter)
... see this answer for how it can be done using the SQL editor: https://stackoverflow.com/a/27195528/10976714osaxma
02/06/2022, 2:09 PMauth.role() = ….
hotbelgo
02/06/2022, 2:25 PMSealion
02/06/2022, 3:23 PMosaxma
02/06/2022, 5:38 PMhotbelgo
02/06/2022, 5:43 PMhotbelgo
02/06/2022, 5:55 PMScott P
02/06/2022, 7:42 PMsockenguy
02/06/2022, 9:00 PMsockenguy
02/06/2022, 9:00 PMosaxma
02/06/2022, 9:05 PMsql
alter user postgres with password 'new_password';
sockenguy
02/06/2022, 9:05 PMsockenguy
02/06/2022, 9:06 PMsockenguy
02/06/2022, 9:06 PMjoshcowan25
02/07/2022, 1:29 AMlavenderlav
02/07/2022, 3:25 AMjdgamble555
02/07/2022, 3:35 AMcreated_at
is not changed by the user? I'm thinking:
typescript
create trigger posts_created_at after update on posts
OLD.created_at === NEW.created_at or undo transaction?
I'm not sure how to confirm this...garyaustin
02/07/2022, 4:20 AMjdgamble555
02/07/2022, 4:21 AMgaryaustin
02/07/2022, 4:35 AMjdgamble555
02/07/2022, 4:45 AMAmusedGrape
02/07/2022, 5:11 AMsupabase.auth.signIn({ provider: 'discord' }, { redirectTo: `${process.env['NEXT_PUBLIC_AUTH_ENDPOINT']}/auth/callback` })
any and all help is appreciated!