From 020a2ae8152a3ae1491e8bef97476af46ee6c90c Mon Sep 17 00:00:00 2001 From: leca Date: Wed, 19 Feb 2025 17:39:03 +0300 Subject: [PATCH] notify user about wrong skin/cape format --- public/js/skin3d.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/public/js/skin3d.js b/public/js/skin3d.js index 04f39c5..e3da2f4 100644 --- a/public/js/skin3d.js +++ b/public/js/skin3d.js @@ -10,12 +10,14 @@ const uploadSkin = async (event) => { let formData = new FormData(); formData.append("file", skinFile); - await fetch(`/api/uploadSkin`, { + const response = await fetch(`/api/uploadSkin`, { method: "POST", body: formData }) - window.location = window.location.href+'?eraseCache=true'; + if (response.status != 200) { + alert(await response.text()) + } } const uploadCape = async (event) => { @@ -30,15 +32,16 @@ const uploadCape = async (event) => { let formData = new FormData(); formData.append("file", capeFile); - await fetch(`/api/uploadCape`, { + const response = await fetch(`/api/uploadCape`, { method: "POST", body: formData }) - window.location = window.location.href+'?eraseCache=true'; + if (response.status != 200) { + alert(await response.text()) + } } - window.onload = async function() { document.getElementById("skinForm").addEventListener("submit", uploadSkin) if (document.getElementById("cape")) {