denoland / fresh

The next-gen web framework.
https://fresh.deno.dev
MIT License
12.19k stars 624 forks source link

redirect to not need anth page by style is missing #2616

Open lik3yoo opened 1 month ago

lik3yoo commented 1 month ago

I want to go to login page when token is missing. And I want to redirect in _middleware.ts like this document describe https://fresh.deno.dev/docs/concepts/middleware#middleware-redirects.

and reuslt like this , style dosen't work. here is my code https://github.com/lik3yoo/fresh-project/blob/main/routes/_middleware.tsx#L11.

Thank you so much image

lik3yoo commented 1 month ago

@marvinhagemeister can you help me

EduM22 commented 1 month ago

I think you have to check ctx.destination and only redirect to login when it is route.