-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-browser.js
42 lines (41 loc) · 1.68 KB
/
gatsby-browser.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
import React from "react";
import { isLoggedIn } from "./src/services/auth/auth";
import Login from "./src/pages/login";
import Layout from "./src/components/layout";
import { UserContextProvider } from "./src/components/providers/user";
export { wrapRootElement } from "./src/apollo/provider";
export const wrapPageElement = ({ element }) => {
if (
!isLoggedIn() &&
element.props.location.pathname !== "/forgotPassword" &&
element.props.location.pathname !== "/resetPassword" &&
element.props.location.pathname !== "/" &&
element.props.location.pathname !== "/team" &&
element.props.location.pathname !== "/member" &&
element.props.location.pathname !== "/team/" &&
element.props.location.pathname !== "/member/" &&
element.props.location.pathname !== "/about" &&
element.props.location.pathname !== "/about/" &&
element.props.location.pathname !== "/contact" &&
element.props.location.pathname !== "/contact/" &&
element.props.location.pathname !== "/faq" &&
element.props.location.pathname !== "/faq/" &&
element.props.location.pathname !== "/caht" &&
element.props.location.pathname !== "/chat/" &&
element.props.location.pathname !== "/findus" &&
element.props.location.pathname !== "/findus/" &&
element.props.location.pathname !== "/legal" &&
element.props.location.pathname !== "/legal/" &&
element.props.location.pathname !== "/createAccount" &&
element.props.location.pathname !== "/createAccount/" &&
element.props.location.pathname !== "/resetPassword/"
) {
return <Login />;
}
return (
<UserContextProvider>
<Layout>{element}</Layout>
</UserContextProvider>
);
};
export default {};