Get user.id server-side in Next.js
I'm trying to select user-specific rows using the UUID in getServerSideProps in Next.js but haven't found a solution yet (using auth-helpers). The below works client side but not server side.
export const getServerSideProps = withPageAuth({
redirectTo: '/',
async getServerSideProps() {
// Find out how many words user is currently studying at novice level - maximum allowed is 200
const { data } = await supabaseServerClient()
.from('_users_vocabulary')
.select('*')
.eq('B', user.id);
return { props: { data } };
}
});
export const getServerSideProps = withPageAuth({
redirectTo: '/',
async getServerSideProps() {
// Find out how many words user is currently studying at novice level - maximum allowed is 200
const { data } = await supabaseServerClient()
.from('_users_vocabulary')
.select('*')
.eq('B', user.id);
return { props: { data } };
}
});