Hello, when I click on “get you account” I have the loader running in a loop.
Do you have an idea ?
Hello, when I click on “get you account” I have the loader running in a loop.
Do you have an idea ?
Well now that you’ve posted your API Key and application ID on a public webpage like codepen, i’m sure nothing will happen to your firebase service.
…
anyway.
What’s sendData do? I dont see a definition for it in your source.
sendData sending the data from my form
Right… but how? You’re telling us you’re getting stuck in a loop when sending the data… but we dont see the function code for the function you’re sending the data with.
here is the code
const sendData = (path, data) => {
fetch(path, {
method: 'post',
headers: new Headers({ 'Content-Type': 'application/json' }),
body: JSON.stringify(data)
})
.then(res => res.json())
.then(data => processData(data));
}
const processData = (data) => {
loader.style.display = null;
if (data.alert) {
showFormError(data.alert);
} else if (data.name) {
sessionStorage.user = JSON.stringify(data);
location.replace('/')
} else if (data.seller) {
let user = JSON.parse(sessionStorage.user)
user.seller = true;
sessionStorage.user = JSON.stringify(user);
location.replace('/dashboard');
}
}
function showFormError(err) {
let errorEle = document.querySelector(".error");
errorEle.innerHTML = err;
errorEle.classList.add("show")
}
presumably you meant to set this to ‘none’ here. Unsetting a display would cause the browser to render it in its default style, which will be block
for most elements.
EDIT: Nevermind, you’re depending on the CSS rule to kick back in. Dur. Still would be better to set it none inline, but… shrug
What URL do you end up at? Which path did it try to send you down?
Just a guess as I don’t want to check all your code on codepen.
You call sendData() from your page. After the data is loaded you replace the page with itself, so it’s reloaded and starts the sendDara() again…
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.