|
|
|
@ -66,9 +66,10 @@ class AppRouter extends Component { |
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
|
const mobile = window.innerWidth < 1000 ? true : false; |
|
|
|
|
let status = proxy.status(); |
|
|
|
|
let home = mobile ? ( |
|
|
|
|
<Route exact path={"/"}> |
|
|
|
|
{proxy.status() ? ( |
|
|
|
|
{status ? ( |
|
|
|
|
this.props.profile.status ? ( |
|
|
|
|
<Home /> |
|
|
|
|
) : ( |
|
|
|
@ -89,105 +90,26 @@ class AppRouter extends Component { |
|
|
|
|
<Switch> |
|
|
|
|
{home} |
|
|
|
|
<Route exact path={"/faq"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
<Faq /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
|
to={{ |
|
|
|
|
pathname: "/", |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : proxy.status() ? ( |
|
|
|
|
<Faq /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
|
to={{ |
|
|
|
|
pathname: "/auth", |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
<Faq /> |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/contact"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
<Contact /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
|
to={{ |
|
|
|
|
pathname: "/", |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : ( |
|
|
|
|
<Contact /> |
|
|
|
|
)} |
|
|
|
|
<Contact /> |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/blogs"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
<Blogs /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
|
to={{ |
|
|
|
|
pathname: "/", |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : ( |
|
|
|
|
<Blogs /> |
|
|
|
|
)} |
|
|
|
|
<Blogs /> |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/blogs/:id"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
<Blog /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
|
to={{ |
|
|
|
|
pathname: "/", |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : ( |
|
|
|
|
<Blog /> |
|
|
|
|
)} |
|
|
|
|
<Blog /> |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/about"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
<About /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
|
to={{ |
|
|
|
|
pathname: "/", |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : ( |
|
|
|
|
<About /> |
|
|
|
|
)} |
|
|
|
|
<About /> |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/products"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
<Products /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
|
to={{ |
|
|
|
|
pathname: "/", |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : ( |
|
|
|
|
<Products /> |
|
|
|
|
)} |
|
|
|
|
<Products /> |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/newProfile"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
status ? ( |
|
|
|
|
<NewProfile /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -202,7 +124,7 @@ class AppRouter extends Component { |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/support"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
status ? ( |
|
|
|
|
<Support /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -216,40 +138,16 @@ class AppRouter extends Component { |
|
|
|
|
)} |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/products/digital/:id"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
<Product page="digital" /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
|
to={{ |
|
|
|
|
pathname: "/", |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : ( |
|
|
|
|
<Product page="digital" /> |
|
|
|
|
)} |
|
|
|
|
<Product page="digital" /> |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/products/physical/:id"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
<Product page="physical" /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
|
to={{ |
|
|
|
|
pathname: "/", |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : ( |
|
|
|
|
<Product page="physical" /> |
|
|
|
|
)} |
|
|
|
|
<Product page="physical" /> |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/qr"}> |
|
|
|
|
<QR /> |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/auth"}> |
|
|
|
|
{proxy.status() ? ( |
|
|
|
|
{status ? ( |
|
|
|
|
<Redirect |
|
|
|
|
to={{ |
|
|
|
|
pathname: "/", |
|
|
|
@ -261,7 +159,7 @@ class AppRouter extends Component { |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/profile"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
status ? ( |
|
|
|
|
<Auth page={"profile"} /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -270,7 +168,7 @@ class AppRouter extends Component { |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : proxy.status() ? ( |
|
|
|
|
) : status ? ( |
|
|
|
|
<Auth page={"profile"} /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -282,7 +180,7 @@ class AppRouter extends Component { |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/qr-scan"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
status ? ( |
|
|
|
|
<QRScan /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -291,7 +189,7 @@ class AppRouter extends Component { |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : proxy.status() ? ( |
|
|
|
|
) : status ? ( |
|
|
|
|
<QRScan /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -303,7 +201,7 @@ class AppRouter extends Component { |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/activation"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
status ? ( |
|
|
|
|
<Activation /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -312,7 +210,7 @@ class AppRouter extends Component { |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : proxy.status() ? ( |
|
|
|
|
) : status ? ( |
|
|
|
|
<Activation /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -324,7 +222,7 @@ class AppRouter extends Component { |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/chatroom"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
status ? ( |
|
|
|
|
<ChatList /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -333,7 +231,7 @@ class AppRouter extends Component { |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : proxy.status() ? ( |
|
|
|
|
) : status ? ( |
|
|
|
|
<ChatList /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -345,7 +243,7 @@ class AppRouter extends Component { |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/cart"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
status ? ( |
|
|
|
|
this.props.userProductList.length > 0 || |
|
|
|
|
!this.state.cartControll ? ( |
|
|
|
|
<Cart /> |
|
|
|
@ -364,7 +262,7 @@ class AppRouter extends Component { |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : proxy.status() ? ( |
|
|
|
|
) : status ? ( |
|
|
|
|
!this.state.cartControll || |
|
|
|
|
this.props.userProductList.length > 0 ? ( |
|
|
|
|
<Cart /> |
|
|
|
@ -386,7 +284,7 @@ class AppRouter extends Component { |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/mybooks"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
status ? ( |
|
|
|
|
<MyBooks /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -395,7 +293,7 @@ class AppRouter extends Component { |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : proxy.status() ? ( |
|
|
|
|
) : status ? ( |
|
|
|
|
<MyBooks /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -407,7 +305,7 @@ class AppRouter extends Component { |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/ar"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
status ? ( |
|
|
|
|
<AR /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -416,7 +314,7 @@ class AppRouter extends Component { |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : proxy.status() ? ( |
|
|
|
|
) : status ? ( |
|
|
|
|
<AR /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -431,7 +329,7 @@ class AppRouter extends Component { |
|
|
|
|
</Route> |
|
|
|
|
<Route exact path={"/chatroom/:id"}> |
|
|
|
|
{mobile ? ( |
|
|
|
|
proxy.status() ? ( |
|
|
|
|
status ? ( |
|
|
|
|
<Chatroom /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -440,7 +338,7 @@ class AppRouter extends Component { |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
) : proxy.status() ? ( |
|
|
|
|
) : status ? ( |
|
|
|
|
<Chatroom /> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
@ -451,25 +349,17 @@ class AppRouter extends Component { |
|
|
|
|
)} |
|
|
|
|
</Route> |
|
|
|
|
<Route path={""}> |
|
|
|
|
{proxy.status() ? ( |
|
|
|
|
<Redirect |
|
|
|
|
to={{ |
|
|
|
|
pathname: "/qr", |
|
|
|
|
search: |
|
|
|
|
"?id=" + |
|
|
|
|
window.location.pathname.slice( |
|
|
|
|
window.location.pathname.lastIndexOf("/") + 1, |
|
|
|
|
window.location.pathname.length |
|
|
|
|
), |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<Redirect |
|
|
|
|
to={{ |
|
|
|
|
pathname: "/auth", |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
<Redirect |
|
|
|
|
to={{ |
|
|
|
|
pathname: "/qr", |
|
|
|
|
search: |
|
|
|
|
"?id=" + |
|
|
|
|
window.location.pathname.slice( |
|
|
|
|
window.location.pathname.lastIndexOf("/") + 1, |
|
|
|
|
window.location.pathname.length |
|
|
|
|
), |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
</Route> |
|
|
|
|
</Switch> |
|
|
|
|
</Router> |
|
|
|
|