skagiya
11/18/2022, 11:08 AMMrPoule
11/18/2022, 11:19 AMstarsend
11/18/2022, 2:02 PMAlexnortung
11/18/2022, 2:21 PMpvtctrlalt
11/18/2022, 2:50 PMrlee128
11/18/2022, 3:15 PMMatt B
11/18/2022, 3:16 PMMDobs
11/18/2022, 3:51 PMconst { data, error } = await supabase.auth.updateUser({email: 'new@email.com'})
From browser
const { dataSignIn, errorSignIn } = await supabase.auth.signInWithPassword({
email: userObject.email,
password: userObject.name,
})
const { dataSession, errorSession } = await supabase.auth.getSession()
const { user, errorUpdateUser } = await supabase.auth.updateUser({
email: email,
password: password
})
These functions don't return anything but null and the data don't change on the DBChunkyLubie
11/18/2022, 3:54 PMNullBitMe
11/18/2022, 4:08 PMIvan Kartashov
11/18/2022, 4:25 PMsql
create or replace function fetch_users(user_id text)
returns json as
$func$
declare @cached_array array
declare @result json
select @cached_array = cached
from public.kisis_cache
where tg_id = $1;
select @result = *
from public.kisis_cache
where tg_id not in cached_array and status = 'active';
return @result
$func$
language sql;
In a few words: I would like to initially fetch the array from table. Then return the records from another table where a column is NOT IN that array.eunuch
11/18/2022, 4:42 PMpvtctrlalt
11/18/2022, 5:49 PMIvan Kartashov
11/18/2022, 6:59 PMNØØne
11/18/2022, 7:41 PMfadethegap
11/18/2022, 8:24 PMkonga
11/18/2022, 9:43 PMzeedee
11/18/2022, 10:25 PMjs
/** @type {import('./$types').Actions} */
export const actions = {
login: async (request, page) => {
const formData = await request.formData();
const { data, error } = await supabaseClient.auth.signInWithPassword({
email: formData.get('email'),
password: formData.get('password'),
})
return {data, error}
},
register: async (event) => {
// TODO register the user
}
};
There is my form action,
html
<form method="POST" action="?/login">
<input name="email" type="email" />
<input name="password" type="password" />
<button>Log in</button>
</form>
the form itself
How to I pass the login back from the server into my app? I tested the login using a clientside function
ts
async function handleRandom(email, password) {
const { data, error } = await supabaseClient.auth.signInWithPassword({
email,
password
});
}
This works. However I need the login handled serverside. What do I need to wire up to make it work?ZebraCoder
11/18/2022, 11:12 PMmalachi
11/18/2022, 11:25 PMepsilon42
11/19/2022, 7:15 AMAndrewSong
11/19/2022, 10:50 AMmeow
11/19/2022, 12:17 PMepsilon42
11/19/2022, 1:42 PMSessionContextProvider
has an initialSession
prop. Does this code do anything in the example, or is getServerSideProps
required in order for this to actually have a value?
import '../styles/globals.css'
import { useState } from 'react'
import type { AppProps } from 'next/app'
import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'
import { SessionContextProvider, Session } from '@supabase/auth-helpers-react'
function MyApp({
Component,
pageProps,
}: AppProps<{
initialSession: Session
}>) {
const [supabaseClient] = useState(() => createBrowserSupabaseClient())
return (
<SessionContextProvider
supabaseClient={supabaseClient}
initialSession={pageProps.initialSession}
>
<Component {...pageProps} />
</SessionContextProvider>
)
}
export default MyApp
YANN
11/19/2022, 2:05 PMts
supabase.from("table").select("id, color");
Ideally I would like to receive the color field in a nested record, as such:
json
{
id: 0,
appearance: {
color: 5
}
}
I know this is possible via graphql, but I would like to avoid using it, thanks in advance!enyo
11/19/2022, 4:10 PMalter default privileges revoke execute on functions from public;
but my function is still available to be invoked with supabase.rpc
. What can I do to prevent a function from being accessible by users?TheGreyRaven
11/19/2022, 4:13 PMadolfoportilla
11/19/2022, 4:43 PMbenyi3k
11/19/2022, 5:11 PMCOP
11/19/2022, 5:35 PM