implementiran share by link

This commit is contained in:
2024-12-13 17:50:12 +01:00
parent 439de9d305
commit 4ab61f9917
15 changed files with 312 additions and 15 deletions

View File

@@ -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")