user
08/03/2021, 7:56 AMDharmaraJ
08/03/2021, 8:03 AM.select('')
carlomigueldy.eth
08/03/2021, 8:12 AMmagicquin
08/03/2021, 8:37 AMjbergius
08/03/2021, 8:37 AMsilentworks
08/03/2021, 9:10 AMsilentworks
08/03/2021, 9:11 AMKang Ming
08/03/2021, 10:11 AMYelloJello
08/03/2021, 10:49 AMMihai Andrei
08/03/2021, 12:39 PMJasper
08/03/2021, 1:21 PMJasper
08/03/2021, 1:21 PMjsx
const [todos, setTodos] = useState([])
useEffect(() => {
supabase.from("todos").select().then(res => {
const list = [];
for (let todo of res.data) {
list.push(todo)
}
setTodos(list)
})
supabase.from("todos")
.on("INSERT", payload => {
setTodos([payload.new, ...todos])
})
.subscribe(payload => {
console.log('schema ', payload)
})
}, [])
Jasper
08/03/2021, 1:21 PMJasper
08/03/2021, 1:22 PMYelloJello
08/03/2021, 2:13 PMJasper
08/03/2021, 2:18 PMJasper
08/03/2021, 2:19 PMsilas
08/03/2021, 4:26 PMsupabase.auth.user()
and supabase.auth.session()
but often the page loads before the auth values are fetched and updated. How are you guys handling this?silas
08/03/2021, 4:34 PMbrohan
08/03/2021, 4:37 PMsilas
08/03/2021, 4:43 PMsilas
08/03/2021, 4:46 PMhandle()
hook that runs as on every route change in SvelteKit https://kit.svelte.dev/docs#hooks-handlesilas
08/03/2021, 4:54 PMsupabase.auth.session
is null
on page load when user is logged innicholaschiang
08/03/2021, 5:13 PMupsert
when multiple columns have a unique
constraint?
Ex: I want to insert a new row into users
if a row with the given ID doesn't already exist. If a row already exists with the same ID, I want to override that existing row BUT I still want to check that the new email and phone will be unique (i.e. if they're the same as the old email/phone, it doesn't matter BUT if they're different, than I want PostgreSQL to check that they're unique).
Database schema:
pgsql
create table public.users (
"id" text unique not null primary key,
"email" text unique,
"phone" text unique
);
fenix
08/03/2021, 5:23 PMspiderz
08/03/2021, 8:21 PMShaneTheKing
08/03/2021, 8:24 PMShaneTheKing
08/03/2021, 8:24 PMspiderz
08/03/2021, 8:30 PMspiderz
08/03/2021, 8:31 PM