fix: only add send ratelimited cookie if we are ratelimited

This commit is contained in:
dusk 2024-08-23 18:32:13 +03:00
parent b5fda85147
commit c951c74fde
Signed by: dusk
SSH Key Fingerprint: SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw

View File

@ -18,8 +18,9 @@ export const actions = {
cookies.set("sendError", err.toString(), { path: "/guestbook" }) cookies.set("sendError", err.toString(), { path: "/guestbook" })
redirect(303, `${PUBLIC_BASE_URL}/guestbook/`) redirect(303, `${PUBLIC_BASE_URL}/guestbook/`)
} }
const ratelimited = respRaw.status === 429 if (respRaw.status === 429) {
cookies.set("sendRatelimited", ratelimited.toString(), { path: "/guestbook" }) cookies.set("sendRatelimited", "true", { path: "/guestbook" })
}
redirect(303, `${PUBLIC_BASE_URL}/guestbook/`) redirect(303, `${PUBLIC_BASE_URL}/guestbook/`)
} }
} }