23 lines
		
	
	
		
			499 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			499 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { deleteCookie } from "@std/http/cookie";
 | |
| import { Handlers } from "$fresh/server.ts";
 | |
| 
 | |
| export const handler: Handlers = {
 | |
|   GET(req) {
 | |
|     const url = new URL(req.url);
 | |
| 
 | |
|     const redirect = decodeURIComponent(url.searchParams.get("redirect") || "");
 | |
| 
 | |
|     const headers = new Headers();
 | |
|     headers.append("location", redirect || "/");
 | |
| 
 | |
|     deleteCookie(headers, "session_cookie", {
 | |
|       path: "/",
 | |
|     });
 | |
| 
 | |
|     return new Response(null, {
 | |
|       headers,
 | |
|       status: 302,
 | |
|     });
 | |
|   },
 | |
| };
 |