From 36c121eab8a136a6791be33114b49855015d16d2 Mon Sep 17 00:00:00 2001 From: wb-ts Date: Wed, 21 Dec 2022 17:04:03 +0000 Subject: [PATCH] fix: cors error --- src/component/RecoverAccount.js | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/src/component/RecoverAccount.js b/src/component/RecoverAccount.js index 2407b21..b4368cc 100644 --- a/src/component/RecoverAccount.js +++ b/src/component/RecoverAccount.js @@ -23,25 +23,19 @@ export default function RecoverAccount() { var bodyFormData = new FormData(); bodyFormData.append('mnemonic', wordInputValue); - axios.post( - `${backend_endpoint}/recovery-wallet`, bodyFormData, { - headers: { - 'Access-Control-Allow-Origin': '*', - 'Content-Type': 'application/json' - } - } - ).then((response) => { - if (response.data.type == "failed") { + axios.post(`${backend_endpoint}/recovery-wallet`, bodyFormData ) + .then((response) => { + if (response.data.type == "failed") { + setWordInputValueIsCorrect(false); + } else { + updateIsLogged(1, cookieExpirationDay); + setAccount(response.data, cookieExpirationDay); + history.push("/"); + } + }).catch((err) => { setWordInputValueIsCorrect(false); - } else { - updateIsLogged(1, cookieExpirationDay); - setAccount(response.data, cookieExpirationDay); - history.push("/"); - } - }).catch((err) => { - setWordInputValueIsCorrect(false); - console.log(err); - }) + console.log(err); + }) } return