implementiran share by link
This commit is contained in:
@@ -3,12 +3,14 @@
|
||||
* @description hooks-up `next-auth` into the page processing pipeline
|
||||
*/
|
||||
|
||||
import { auth, authConfig } from '@/app/lib/auth'
|
||||
import { auth, authConfig, myAuth } from '@/app/lib/auth'
|
||||
import createIntlMiddleware from 'next-intl/middleware';
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { locales, defaultLocale } from '@/app/i18n';
|
||||
import { Session } from 'next-auth';
|
||||
|
||||
const publicPages = ['/terms', '/policy', '/login'];
|
||||
// http://localhost:3000/share/location/675c41b227d0df76a35f106e
|
||||
const publicPages = ['/terms', '/policy', '/login', '/share/location/.*', '/share/bill/.*'];
|
||||
|
||||
const intlMiddleware = createIntlMiddleware({
|
||||
locales,
|
||||
@@ -30,7 +32,8 @@ export default async function middleware(req: NextRequest) {
|
||||
// based on https://github.com/nextauthjs/next-auth/discussions/8961
|
||||
// The official way of chaining middlewares in AuthJS v5 does not work and is not fully documented
|
||||
if (!isPublicPage) {
|
||||
const session = await auth();
|
||||
|
||||
const session = await myAuth();
|
||||
|
||||
if (!session) {
|
||||
const signInUrl = `${req.nextUrl.protocol}//${req.nextUrl.hostname}${req.nextUrl.port ? `:${req.nextUrl.port}` : ''}${authConfig.pages?.signIn as string}`;
|
||||
|
||||
Reference in New Issue
Block a user