fix middle v105
This commit is contained in:
@@ -14,8 +14,7 @@ export async function GET(req: Request) {
|
||||
console.log("Token received in Cookies:", tokenCookies);
|
||||
|
||||
const tokenHeader = req.headers.get("Authorization")?.split(" ")[1];
|
||||
console.log("Token received in Header:", tokenHeader);
|
||||
|
||||
console.log("Token received in Header:", tokenHeader);
|
||||
|
||||
if (!tokenCookies) return NextResponse.json({ success: false });
|
||||
return NextResponse.json({ success: true });
|
||||
|
||||
@@ -162,10 +162,11 @@ export const middleware = async (req: NextRequest) => {
|
||||
}
|
||||
|
||||
try {
|
||||
const originURL = new URL(req.url).origin;
|
||||
const originURL = process.env.NEXT_PUBLIC_API_URL;
|
||||
console.log("Origin URL >> ", originURL);
|
||||
const pathApiValidation = `${new URL(req.url).origin}/api/validation`;
|
||||
const validationResponse = await fetch(pathApiValidation, {
|
||||
|
||||
const apiBaseUrl = process.env.NEXT_PUBLIC_API_URL || new URL(req.url).origin;
|
||||
const validationResponse = await fetch(`${apiBaseUrl}/api/validation`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user