From 70264cefc845b82b6a9a52103e2e7de55fd63d06 Mon Sep 17 00:00:00 2001 From: IoT Manager <67171972+IoTManagerProject@users.noreply.github.com> Date: Fri, 6 Oct 2023 23:54:58 +0200 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=D0=B4=D0=BD?= =?UTF-8?q?=D1=8F=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=87=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 4 ++-- src/pages/Profile.svelte | 34 +++++----------------------------- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/public/index.html b/public/index.html index be1bcea..a8152c5 100644 --- a/public/index.html +++ b/public/index.html @@ -7,9 +7,9 @@ IoT Manager 4.5.1 - + - + diff --git a/src/pages/Profile.svelte b/src/pages/Profile.svelte index 18315c5..ffa7bac 100644 --- a/src/pages/Profile.svelte +++ b/src/pages/Profile.svelte @@ -104,42 +104,18 @@ } }; - //иногда не отправляет токен - непонятно почему - //const placeOrder = async () => { - // delete myProfileJson["_id"]; - // const JWT = Cookies.get("token_iotm2"); - // try { - // let res = await fetch("https://portal.iotmanager.org/compiler/order", { - // mode: "cors", - // method: "POST", - // headers: { - // "Content-Type": "application/json", - // Authorization: `Bearer ${JWT}`, - // }, - // body: JSON.stringify(myProfileJson), - // }); - // const content = await res.json(); - // if (res.ok) { - // errors = [{ msg: "ok_success" }]; - // await getUserBuilds(); - // console.log(content.message); - // } else { - // errors = content.message; - // } - // } catch (e) { - // console.log(e); - // } - //}; - - //временно используем без jwt const placeOrder = async () => { delete myProfileJson["_id"]; + //добавим в тело имя пользователя + myProfileJson.username = userdata.username; + const JWT = Cookies.get("token_iotm2"); try { - let res = await fetch("https://portal.iotmanager.org/compiler/esporder", { + let res = await fetch("https://portal.iotmanager.org/compiler/order", { mode: "cors", method: "POST", headers: { "Content-Type": "application/json", + Authorization: `Bearer ${JWT}`, }, body: JSON.stringify(myProfileJson), });