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), });