Skip to content

Commit 5f0bdd6

Browse files
committed
* Fix for gatsby builds
1 parent 072d53f commit 5f0bdd6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/contexts/MainContextProvider/index.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import React, { useReducer, createContext } from 'react';
22
import MainReducer from '../../reducers/MainReducer';
33

4-
const themeIndex = localStorage.themeIndex ? parseFloat(localStorage.themeIndex) : 0;
5-
const themeColorIndex = localStorage.themeColorIndex ? parseFloat(localStorage.themeColorIndex) : 0;
4+
const themeIndex = typeof window !== 'undefined' && localStorage.themeIndex ? parseFloat(localStorage.themeIndex) : 0;
5+
const themeColorIndex = typeof window !== 'undefined' && localStorage.themeColorIndex
6+
? parseFloat(localStorage.themeColorIndex)
7+
: 0;
68

79
const initState = {
810
pageIndex: 0,

0 commit comments

Comments
 (0)