Kylar
09/27/2021, 2:51 PMAdnane
09/27/2021, 2:54 PMlarryM
09/27/2021, 5:20 PMliljamesjohn
09/27/2021, 5:37 PMliljamesjohn
09/27/2021, 5:37 PMgaryaustin
09/27/2021, 10:21 PMKylar
09/28/2021, 10:50 AMbokolesnik
09/28/2021, 1:39 PM.query('SELECT * FROM Table LIMIT 100;')
?Scott P
09/28/2021, 1:40 PMbokolesnik
09/28/2021, 2:02 PMScott P
09/28/2021, 2:04 PMpg
library can do it.bokolesnik
09/28/2021, 2:12 PM.limit(500)
works fine, but .limit(1000)
isn't. limit in Settings is 10k. supabase UI and SQL sandbox work correctlyjaded
09/28/2021, 2:32 PMjaded
09/28/2021, 2:35 PMconst [produktos, setProduktos] = useState([])
useEffect(() => {
getProduktos()
}, [])
async function getProduktos() {
const { data } = await supabase
.from('products')
.select()
setProduktos(data)
console.log("data: ", data)
}
jaded
09/28/2021, 3:03 PMRLS
blocking mejaded
09/28/2021, 3:04 PMgaryaustin
09/28/2021, 3:12 PMstibbs
09/29/2021, 1:38 PMliljamesjohn
09/29/2021, 1:42 PMstibbs
09/29/2021, 9:05 PMhandleAuthChange
function
js
async function handleAuthChange(event, session) {
await fetch('/api/auth', {
method: 'POST',
headers: new Headers({ 'Content-Type': 'application/json' }),
credentials: 'same-origin',
body: JSON.stringify({ event, session })
});
}
and added it to my context provider
js
useEffect(() => {
const session = supabase.auth.session();
setSession(session);
handleAuthChange({ event: 'SIGNED_IN' }, session); // NEW
setUser(session?.user ?? false);
const { data: authListener } = supabase.auth.onAuthStateChange(
async (event, session) => {
setSession(session);
handleAuthChange(event, session); // NEW
setUser(session?.user ?? false);
}
);
api/auth.js
js
import supabase from '@utils/supabase';
const AuthCookie = async (req, res) => {
supabase.auth.api.setAuthCookie(req, res);
};
export default AuthCookie;
and then ensure the cookie is used by the api by adding
js
import supabase from '@utils/supabase';
const YourApiHere = async (req, res) => {
supabase.auth.setAuth(req.cookies['sb:token']);
...
};
liljamesjohn
09/29/2021, 9:07 PMstibbs
09/29/2021, 9:09 PMstibbs
09/29/2021, 9:12 PMawait supabase.from('my_table').select('*');
will work with or without RLS enabled, but if RLS is enabled your call of the api needs to have the cookiestibbs
09/29/2021, 9:13 PMliljamesjohn
09/29/2021, 9:34 PMseufernandez
09/29/2021, 9:38 PMstibbs
09/29/2021, 11:32 PMliljamesjohn
09/29/2021, 11:33 PMstibbs
09/29/2021, 11:36 PMstibbs
09/29/2021, 11:46 PMsupabase.auth.setAuth(req.cookies['sb:token']);
before executing your db call