-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFittingPage.js
69 lines (61 loc) · 2.02 KB
/
FittingPage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import Navigation from '../Navigationbar/Nav'
import LeftFitContainer from './LeftFitContainer'
import RightFitContainer from './RightFitContainer'
import styles from './FittingPage.module.css'
import React from 'react'
import { useState, useCallback } from 'react'
import shoppingImage from '../../images/shopping-mall.png'
import { Navigate } from 'react-router-dom'
import FittingPageAlert from './FittingPageAlert'
import 'react-responsive-carousel/lib/styles/carousel.min.css'
function FittingPage() {
// const user = useSelector((state) => state.auth.user)
const [fittingImage, setFittingImage] = useState('')
const [isDefaultPage, setIsDefaultPage] = useState(true)
const [isShowAlert, setIsShowAlert] = useState(false)
const [errorCode, setErrorCode] = useState(null)
const lsUser = JSON.parse(localStorage.getItem('user'))
const lsToken = localStorage.getItem('token')
const showAlert = (time = 3000) => {
setIsShowAlert(true)
setTimeout(() => {
setIsShowAlert(false)
}, time)
}
if (lsUser && lsToken) {
return (
<>
<Navigation />
<div
className={styles.mainContainer}
style={{ backgroundImage: `url(${shoppingImage})` }}
>
<div className="empty-space" />
<LeftFitContainer
fittingImage={fittingImage}
setIsDefaultPage={setIsDefaultPage}
isDefaultPage={isDefaultPage}
setErrorCode={setErrorCode}
showAlert={showAlert}
/>
<div className="empty-space" />
<RightFitContainer
setFittingImage={setFittingImage}
setIsDefaultPage={setIsDefaultPage}
setErrorCode={setErrorCode}
showAlert={showAlert}
/>
<div className="empty-space" />
</div>
<FittingPageAlert
errorCode={errorCode}
isShowAlert={isShowAlert}
setIsShowAlert={setIsShowAlert}
/>
</>
)
} else {
return <Navigate to={'/'} />
}
}
export default FittingPage