Skip to content

Commit

Permalink
edge
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrixer committed Dec 14, 2021
1 parent 58b14a7 commit 9d612d3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pages/_middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { NextResponse } from 'next/server'

const signedinPages = ['/', '/playlist', '/library']

export default function middleware(req) {
if (signedinPages.find((p) => p === req.nextUrl.pathname)) {
const token = req.cookies.TRAX_ACCESS_TOKEN

if (!token) {
return NextResponse.redirect('/signin')
}
}
}

0 comments on commit 9d612d3

Please sign in to comment.