Skip to content

Commit

Permalink
fix: better error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Chirag Ghosh <[email protected]>
  • Loading branch information
chirag-ghosh committed Jun 29, 2024
1 parent 0e63a49 commit 34b5dc8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions frontend/src/pages/Register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const Register: Component = () => {
const [getMsg, setMsg] = createSignal("");
const [getIsLoad, setIsLoad] = createSignal(true)
const [getIsErr, setIsErr] = createSignal(false)
const [getIsDup, setIsDup] = createSignal(false)


onMount(() => {
Expand All @@ -27,7 +26,6 @@ export const Register: Component = () => {
}, 3000);
}
else if(data.status === 409){
setIsDup(true);
setStatus("User Already Registered!")
setMsg("Check your institute mail for login credentials")

Expand All @@ -45,6 +43,11 @@ export const Register: Component = () => {
setMsg(bodyData)
})
}
}).catch((err) => {
setIsLoad(false);
setIsErr(true)
setStatus("User Registration Error!")
setMsg(err.toString())
})
})

Expand All @@ -62,7 +65,7 @@ export const Register: Component = () => {
<div class="reg-status">
<div class="reg-status-title">{getStatus()}</div>
<div class="reg-status-svg">
{getIsLoad() == true ? <Spinner /> : (getIsDup() == true ? <img src={cross} /> : (getIsErr() == true ? <img src={cross}/> : <img src={check} />))}
{getIsLoad() == true ? <Spinner /> : (getIsErr() == true ? <img src={cross}/> : <img src={check} />)}
</div>
<div class="reg-status-text">{getMsg()}</div>
</div>
Expand Down

0 comments on commit 34b5dc8

Please sign in to comment.