xyz
01/04/2023, 8:27 PMchrister
01/04/2023, 8:52 PMconst { auth } = useSupabaseClient()
const signIn = async () => {
const { data, error } = await auth.signInWithPassword({
email: email.value,
password: password.value
})
if (error) {
return alert('Something went wrong !')
}
if(data.user.id){
console.log(data)
//router.push('/account/portfolio')
}
}
(i have tried multiple iterations of it, like const supabase = useSupabaseClient(), without const {data, error} etc etc)
This is the code that is giving me errors:
const user = useSupabaseUser()
const { data } = await useAsyncData('address_line', async () => {
let { data } = await supabase
.from('accounts')
.select('address_line')
.eq('user_id', user.value.id)
.single()
return data
})
Could anyone please a practical example of how this is done the proper way?dont
01/04/2023, 9:28 PMteams
where that users id
is joined with the team in the team_members
table.
I have this so far, but it is returning all teams, this rls is on the teams
table
(auth.uid() = ( SELECT team_members.user_id
FROM team_members
WHERE (team_members.user_id = auth.uid())))
Brian
01/04/2023, 9:49 PMzetashift
01/04/2023, 10:08 PMfoo.workdomain.io
where foo
is a company name. This process needs to be automated somewhat.
Is this a problem https://supabase.com/docs/guides/platform/custom-domains#vanity-subdomains vanity domains can solve, or am I better off looking at other options?vadim
01/04/2023, 11:32 PMhensou
01/04/2023, 11:36 PMGuy Rozen
01/04/2023, 11:42 PMnkeating
01/04/2023, 11:59 PMplaces.id
.",
"format": "bigint",
"type": "integer"
},
I then added a view
create view my_view as select pl.col1, pl.col2, pl.col3, pl.id, array_agg(f.path) as paths from files f
inner join projects_files pf on pf.file_id = f.id
left join projects p on p.id = pf.project_id
inner join places pl on pl.id = p.place_id
group by pl.col1, pl.id;
After adding this view the API spec now returns
"place_id": {
"description": "Note:\nThis is a Foreign Key to my_view.id
.",
"format": "bigint",
"type": "integer"
},
I rely on this response to build values in my app, and this is causing things to break. The foreign key on projects is still obviously pointing to places and not to this view. Can someone please let me know why this could be happening and what I can do to fix this? I need the id from places in my view, so that is unavoidable, is there a workaround? Has anyone else faced this issue?
Look forward to any help here!Jingly
01/05/2023, 12:05 AMluke90275
01/05/2023, 12:09 AMPythonic
01/05/2023, 1:27 AMts
import { createClient } from '@supabase/supabase-js';
createClient(SUPABASE_URL, SUPABASE_ANON_KEY, {global: { headers: {
Authorization: `Bearer ${access_token}`
}}})
However does this only work if the access_token
doesn't change? With OAuth the access token for each user has to be refreshed every 6 hours, so would I be able to initialize a client with the new access token and it will give me the correct user?
Thanks.SimonPotvin
01/05/2023, 2:05 AMcar
01/05/2023, 2:42 AMpickwickian
01/05/2023, 3:18 AMCheqo
01/05/2023, 3:21 AMalxT
01/05/2023, 3:30 AMczypnt
01/05/2023, 4:02 AMDeepITM
01/05/2023, 4:16 AMquick_piper15
01/05/2023, 4:48 AMrinorzk
01/05/2023, 6:10 AMizurugi
01/05/2023, 9:48 AMsinrabo
01/05/2023, 10:13 AMCherterB
01/05/2023, 11:21 AMKirioXX
01/05/2023, 11:33 AMMaheshtheDev
01/05/2023, 11:42 AMkresimirgalic
01/05/2023, 12:40 PMRridrock
01/05/2023, 1:01 PMsupabase.auth .setSession({ access_token: accessToken, refresh_token: refreshToken, })
The app is subscribed to supabase.auth.onAuthStateChange but setSession doesn't call _notifyAllSubscribers, so app cannot recognize when the user is signed in.Ladlum
01/05/2023, 1:57 PMMihai Andrei
01/05/2023, 3:42 PM