Make console.log appear on every request that is not authping

This commit is contained in:
qowevisa 2024-11-10 08:20:44 +02:00
parent 9bb01c811b
commit be64733578

View File

@ -6,19 +6,22 @@ import type { HandleFetch } from "@sveltejs/kit";
// return await resolve(event) // return await resolve(event)
// } // }
console.log("in hooks file: 1")
export const handleFetch: HandleFetch = async ({ request, fetch }) => { export const handleFetch: HandleFetch = async ({ request, fetch }) => {
if (!request.url.match('authping')) {
console.log(request) console.log(request)
console.log("handleFetch triggered for URL:", request.url); console.log("handleFetch triggered for URL:", request.url);
console.log("in handleFetch: 2") console.log("in handleFetch: 2")
}
if (request.url.startsWith("https://api.fin.qowevisa.click/api")) { if (request.url.startsWith("https://api.fin.qowevisa.click/api")) {
request = new Request( request = new Request(
request.url.replace("https://api.fin.qowevisa.click/api", "http://localhost:3000/api"), request.url.replace("https://api.fin.qowevisa.click/api", "http://localhost:3000/api"),
request request
) )
}; };
if (!request.url.match('authping')) {
console.log(request) console.log(request)
console.log("in handleFetch: 3") console.log("in handleFetch: 3")
}
return fetch(request); return fetch(request);
}; };