0

Is it possible to avoid making a water fall of these 2 calls to Supabase? It would be awesome to load the data in parallell.

export async function POST({ request }) {
  const reqData = await request.json();
  const userId = reqData.brukerRow.id;    
  const user = await supabaseClient.auth.admin.getUserById(userId);
  const roles = await supabaseClient.from('payPhoneRoles')
    .select('id, role_name')
    .order('id', { ascending: true });
  const returnObj = {
    user: user.data.user,
    availableRoles: roles.data
  };
  return json(returnObj, { status: 200 });   
}
rozsazoltan
  • 2,831
  • 2
  • 7
  • 20
johnohod
  • 494
  • 5
  • 19
  • 1
    Does this answer your question? [Call async/await functions in parallel](https://stackoverflow.com/questions/35612428/call-async-await-functions-in-parallel) – H.B. Jul 04 '23 at 18:58

0 Answers0