* feat: support hono rpc * add wrangler file * update name of wrangler file * add wrangler as a dependency * add compatibility_flags * trigger ci * core: add health check to docker file * expose port 80 * update custom healthcheck * feat: implement openapi * install dependencies in root * debug yml * update yml * update port * update dockerfile with envs * completely move away from apiClient * rename backend to api * refactor: update server descriptions and comment out local spec saving * update lock file * use api.classroomio.com * add support for redis * fix: add missing line break in WelcomeModal.svelte * refactor: remove wrangler configuration and update Vite config for API integration
22 lines
455 B
TypeScript
22 lines
455 B
TypeScript
import { User } from '@supabase/supabase-js';
|
|
import { getSupabase } from '../supabase';
|
|
|
|
const supabase = getSupabase();
|
|
|
|
export async function validateUser(accessToken: string): Promise<User> {
|
|
let user: User | null = null;
|
|
|
|
try {
|
|
const { data } = await supabase.auth.getUser(accessToken);
|
|
user = data.user;
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
|
|
if (!user) {
|
|
throw new Error('Unauthenticated user');
|
|
}
|
|
|
|
return user;
|
|
}
|