From 4f83de33352ddda4fb34e375090e93219f2f8430 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Fri, 16 Sep 2022 20:31:46 +0200 Subject: [PATCH] Use status URL when checking group existence. This avoids issues with redirects. --- static/mainpage.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/mainpage.js b/static/mainpage.js index 02f6120..6fda1e7 100644 --- a/static/mainpage.js +++ b/static/mainpage.js @@ -30,12 +30,13 @@ document.getElementById('groupform').onsubmit = async function(e) { if(group === '') return; let url = '/group/' + group + '/'; + let statusUrl = url + '.status.json'; try { groupinput.disabled = true; button.disabled = true; try { - let resp = await fetch(url, { + let resp = await fetch(statusUrl, { method: 'HEAD', }); if(!resp.ok) { @@ -46,7 +47,7 @@ document.getElementById('groupform').onsubmit = async function(e) { return; } } catch(e) { - displayError(`Coudln't connect: ${e.toString()}`); + displayError(`Couldn't connect: ${e.toString()}`); return; } } finally {