Skip to content

Commit

Permalink
增加admin重定向
Browse files Browse the repository at this point in the history
  • Loading branch information
MarSeventh committed Sep 13, 2024
1 parent 4bab285 commit 8e8f68b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions functions/admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export async function onRequest(context) {
// 重定向到/dashboard
const {
request, // same as existing Worker API
env, // same as existing Worker API
params, // if filename includes [id] or [[path]]
waitUntil, // same as ctx.waitUntil in existing Worker API
next, // used for middleware or to fetch assets
data, // arbitrary space for passing data between middlewares
} = context;
//get the request url
const url = new URL(request.url);
//redirect to dashboard page
return Response.redirect(url.origin+"/dashboard", 302)
}

0 comments on commit 8e8f68b

Please sign in to comment.