diff --git a/src/middleware.ts b/src/middleware.ts
new file mode 100644
index 0000000..b92eb5f
--- /dev/null
+++ b/src/middleware.ts
@@ -0,0 +1,26 @@
+import { NextRequest, NextResponse } from 'next/server';
+
+export function middleware(req: NextRequest) {
+ const url = req.nextUrl.clone();
+ const path = url.pathname;
+
+ if (
+ path.startsWith('/customer-dashboard') ||
+ path.startsWith('/corporate-dashboard')
+ ) {
+ const token = req.cookies.get(
+ `${path.includes('customer') ? 'bonus' : 'corporate'}__token`,
+ );
+
+ if (!token) {
+ url.pathname = '/login';
+ return NextResponse.redirect(url);
+ }
+ }
+
+ return NextResponse.next();
+}
+
+export const config = {
+ matcher: ['/customer-dashboard/:path*', '/corporate-dashboard/:path*'],
+};
diff --git a/src/pages-templates/(dashboard)/corporate-dashboard/index.tsx b/src/pages-templates/(dashboard)/corporate-dashboard/index.tsx
index 2353347..062b643 100644
--- a/src/pages-templates/(dashboard)/corporate-dashboard/index.tsx
+++ b/src/pages-templates/(dashboard)/corporate-dashboard/index.tsx
@@ -1,5 +1,6 @@
'use client';
+import { deleteCookie } from 'cookies-next';
import { subMonths } from 'date-fns';
import { Building2, LogOut, Wallet } from 'lucide-react';
import { useState } from 'react';
@@ -104,9 +105,16 @@ export function CorporateDashboard() {
-
+
{t('corporate.pageTitle')}
-