Skip to content

Commit

Permalink
fix: http header
Browse files Browse the repository at this point in the history
  • Loading branch information
onlyoon committed Dec 23, 2023
1 parent 54fdb42 commit 22b9a02
Showing 1 changed file with 31 additions and 26 deletions.
57 changes: 31 additions & 26 deletions src/routes/(mono-column)/signup/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,25 @@
}
const centerPosition = (slider.clientWidth * currentSlidePosition) / 600;
slider.scrollTo({ left: centerPosition, behavior: "smooth" });
}
};
const emailAuth = async (email) => {
userEmail = email;
const requestData = {
email: email,
};
const fetchData = {
method: 'post',
headers: {
'Content-Type': 'application/json;charset=UTF-8'
},
body: JSON.stringify(requestData)
}
if (validateEmail(email)) {
alert("이메일 형식이 올바릅니다.");
await fetch("https://dev.q-box.site/api/emails", {
method: "post",
body: JSON.stringify(requestData),
}).then(async (response) => {
await fetch("https://dev.q-box.site/api/emails", fetchData).then(async (response) => {
if (Response.status >= 200 && Response.status < 300) {
slide("next")
slide("next");
return response.json();
} else {
const errData = await response.json();
Expand All @@ -55,21 +56,26 @@
const requestData = {
key: code,
};
await fetch( import.meta.env.VITE_API_URL + `/emails`, {
method: "post",
body: JSON.stringify(requestData),
}).then(async (response) => {
if (Response.status >= 200 && Response.status < 300) {
console.log(`인증완료`);
slide("next")
return response.json();
} else {
const errData = await response.json();
console.log(errData);
throw new Error("Something went wrong (server side)");
}
});
};
const fetchData = {
method: 'post',
headers: {
'Content-Type': 'application/json;charset=UTF-8'
},
body: JSON.stringify(requestData)
}
await fetch(import.meta.env.VITE_API_URL + `/emails`, fetchData).then(async (response) => {
if (Response.status >= 200 && Response.status < 300) {
console.log(`인증완료`);
slide("next");
return response.json();
} else {
const errData = response.json();
console.log(errData);
throw new Error("Something went wrong (server side)");
}
});
};
// 이메일 체크
const validateEmail = (email) => {
Expand All @@ -89,10 +95,9 @@
{#if step === "emailAuth"}
<Card {step} {slide} {emailAuth} />
{:else if step === "authComplete"}
<Card {step} {slide} {authCodeVerification} {userEmail}/>
<Card {step} {slide} {authCodeVerification} {userEmail} />
{:else}
<Card {step} {slide} />

{/if}
{/each}
</div>
Expand Down

0 comments on commit 22b9a02

Please sign in to comment.