Configure the offline support in the environment setup.
This commit is contained in:
@@ -11,6 +11,7 @@ export const environment = {
|
|||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
enabledOAuthLogin: true,
|
enabledOAuthLogin: true,
|
||||||
|
enabledOffline: true,
|
||||||
appName: 'Green',
|
appName: 'Green',
|
||||||
defaultProfileCover: 'https://firebasestorage.googleapis.com/v0/b/open-social-33d92.appspot.com/o/images%2F751145a1-9488-46fd-a97e-04018665a6d3.JPG?alt=media&token=1a1d5e21-5101-450e-9054-ea4a20e06c57',
|
defaultProfileCover: 'https://firebasestorage.googleapis.com/v0/b/open-social-33d92.appspot.com/o/images%2F751145a1-9488-46fd-a97e-04018665a6d3.JPG?alt=media&token=1a1d5e21-5101-450e-9054-ea4a20e06c57',
|
||||||
defaultLanguage: LanguageType.English
|
defaultLanguage: LanguageType.English
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export const environment = {
|
|||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
enabledOAuthLogin: true,
|
enabledOAuthLogin: true,
|
||||||
|
enabledOffline: true,
|
||||||
appName: 'Green',
|
appName: 'Green',
|
||||||
defaultProfileCover: 'https://firebasestorage.googleapis.com/v0/b/open-social-33d92.appspot.com/o/images%2F751145a1-9488-46fd-a97e-04018665a6d3.JPG?alt=media&token=1a1d5e21-5101-450e-9054-ea4a20e06c57',
|
defaultProfileCover: 'https://firebasestorage.googleapis.com/v0/b/open-social-33d92.appspot.com/o/images%2F751145a1-9488-46fd-a97e-04018665a6d3.JPG?alt=media&token=1a1d5e21-5101-450e-9054-ea4a20e06c57',
|
||||||
defaultLanguage: LanguageType.English
|
defaultLanguage: LanguageType.English
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import defaultConfig from '@redux-offline/redux-offline/lib/defaults'
|
|||||||
// replacing redux-offline defaults with immutable* counterparts
|
// replacing redux-offline defaults with immutable* counterparts
|
||||||
import { persist, persistAutoRehydrate, offlineStateLens } from 'redux-offline-immutable-config'
|
import { persist, persistAutoRehydrate, offlineStateLens } from 'redux-offline-immutable-config'
|
||||||
|
|
||||||
|
import config from 'src/config'
|
||||||
// Create a history of your choosing (we're using a browser history in this case)
|
// Create a history of your choosing (we're using a browser history in this case)
|
||||||
export const history = createHistory()
|
export const history = createHistory()
|
||||||
|
|
||||||
@@ -33,8 +34,8 @@ let initialState = {
|
|||||||
|
|
||||||
// - Config and create store of redux
|
// - Config and create store of redux
|
||||||
const composeEnhancers = composeWithDevTools({
|
const composeEnhancers = composeWithDevTools({
|
||||||
// Specify extension’s options like name, actionsBlacklist, actionsCreators, serialize...
|
// Specify extension’s options like name, actionsBlacklist, actionsCreators, serialize...
|
||||||
})
|
})
|
||||||
|
|
||||||
const persistOptions = {}
|
const persistOptions = {}
|
||||||
const persistCallback = () => {
|
const persistCallback = () => {
|
||||||
@@ -49,9 +50,15 @@ const offlineConfig = {
|
|||||||
persistCallback,
|
persistCallback,
|
||||||
offlineStateLens
|
offlineStateLens
|
||||||
}
|
}
|
||||||
|
let store: Store<any>
|
||||||
let store: Store<any> = createStore(rootReducer(history), fromJS(initialState), composeEnhancers(
|
if (config.settings.enabledOffline) {
|
||||||
applyMiddleware(logger,thunk, routerMiddleware(history), sagaMiddleware), offline(offlineConfig)
|
store = createStore(rootReducer(history), fromJS(initialState), composeEnhancers(
|
||||||
))
|
applyMiddleware(logger,thunk, routerMiddleware(history), sagaMiddleware), offline(offlineConfig)
|
||||||
|
))
|
||||||
|
} else {
|
||||||
|
store = createStore(rootReducer(history), fromJS(initialState), composeEnhancers(
|
||||||
|
applyMiddleware(logger,thunk, routerMiddleware(history), sagaMiddleware)
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
export default {store, runSaga: sagaMiddleware.run, close: () => store.dispatch(END), history}
|
export default {store, runSaga: sagaMiddleware.run, close: () => store.dispatch(END), history}
|
||||||
|
|||||||
Reference in New Issue
Block a user