implementiran share by link
This commit is contained in:
@@ -5,6 +5,23 @@ import { Session } from 'next-auth';
|
||||
import { AuthenticatedUser } from './types/next-auth';
|
||||
import { defaultLocale } from '../i18n';
|
||||
|
||||
export const myAuth = () => {
|
||||
|
||||
// Ovo koristim u developmentu
|
||||
//
|
||||
// const session:Session = {
|
||||
// user: {
|
||||
// id: "123",
|
||||
// name: "Test User",
|
||||
// },
|
||||
// expires: "123",
|
||||
// };
|
||||
//
|
||||
// return(Promise.resolve(session));
|
||||
|
||||
return(auth());
|
||||
}
|
||||
|
||||
export const authConfig: NextAuthConfig = {
|
||||
callbacks: {
|
||||
// method verifies if the user is logged in or not
|
||||
@@ -83,7 +100,7 @@ export const isAuthErrorMessage = (obj: any): obj is AuthErrorMessage => {
|
||||
}
|
||||
|
||||
export const withUser = <T, A extends any[]>(fn: (user: AuthenticatedUser, ...args:A) => Promise<T>) => async (...args:A) => {
|
||||
const session = await auth();
|
||||
const session = await myAuth();
|
||||
|
||||
if(!session) {
|
||||
throw new Error("Not authenticated")
|
||||
|
||||
Reference in New Issue
Block a user