diff --git a/app/lib/auth.ts b/app/lib/auth.ts index d616894..a32437f 100644 --- a/app/lib/auth.ts +++ b/app/lib/auth.ts @@ -59,16 +59,11 @@ export const isAuthErrorMessage = (obj: any): obj is AuthErrorMessage => { return (obj.message && obj.errors && obj.errors.message); } -export const withUser = (fn: (user: AuthenticatedUser, ...args:any) => Promise) => async (...args:any) => { +export const withUser = (fn: (user: AuthenticatedUser, ...args:A) => Promise) => async (...args:A) => { const session = await auth(); if(!session) { - return({ - errors: { - message: "Not authenticated", - }, - message: "Not authenticated", - } as AuthErrorMessage); + throw new Error("Not authenticated") } const { user } = session;