completed issue with login user being set incorrectly

This commit is contained in:
2021-12-12 16:29:38 -06:00
parent d10da2257d
commit 6c23b98f90
2 changed files with 13 additions and 5 deletions
+12 -4
View File
@@ -7,7 +7,7 @@ export const Login = () => {
const [email, set] = useState("")
const existDialog = useRef()
const history = useHistory()
let [gbt_customer, setgbt_customer] = useState(1)
@@ -21,7 +21,7 @@ export const Login = () => {
const handleLogin = (e) => {
e.preventDefault()
existingUserCheck()
.then(exists => {
.then (exists => {
if (exists) {
localStorage.setItem("graphicsbaytracker_customer", exists.id)
history.push("")
@@ -31,7 +31,15 @@ export const Login = () => {
})
}
const skipLogin = () => {
const setLocalStorageUser = () => localStorage.setItem("graphicsbaytracker_customer", 1)
const skipToHome = () => history.replace('./GraphicsBayTrackerHome')
return (setLocalStorageUser(), skipToHome())
}
const redirectToRegister = () => {
history.replace("./Register")
}
return (
@@ -61,9 +69,9 @@ export const Login = () => {
</form>
</section>
<section className="link--register">
<Link to="/register">Not a member yet?</Link>
<button onClick={ redirectToRegister} >Not a member yet?</button>
</section>
<button onClick={ () => localStorage.setItem("graphicsbaytracker_customer", 1)}>Skip Login</button>
<button onClick={ skipLogin }>Skip Login</button>
</main>
@@ -5,6 +5,6 @@ export const GraphicsBayTrackerHome =()=>{
return <div>
<p>GraphicsBayTrackerHome</p>
</div>
}