mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-07-19 18:21:54 +00:00
Set everything up to use hooks for reduc actions and state
This commit is contained in:
@@ -5,7 +5,6 @@ import { provideServices as provideApiServices } from '../api/services/provideSe
|
||||
import { provideServices as provideAppServices } from '../app/services/provideServices';
|
||||
import { provideServices as provideCommonServices } from '../common/services/provideServices';
|
||||
import { provideServices as provideServersServices } from '../servers/services/provideServices';
|
||||
import { provideServices as provideSettingsServices } from '../settings/services/provideServices';
|
||||
import { provideServices as provideUtilsServices } from '../utils/services/provideServices';
|
||||
import type { ConnectDecorator } from './types';
|
||||
|
||||
@@ -39,4 +38,3 @@ provideCommonServices(bottle, connect);
|
||||
provideApiServices(bottle);
|
||||
provideServersServices(bottle, connect);
|
||||
provideUtilsServices(bottle);
|
||||
provideSettingsServices(bottle, connect);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { configureStore } from '@reduxjs/toolkit';
|
||||
import type { IContainer } from 'bottlejs';
|
||||
import type { RLSOptions } from 'redux-localstorage-simple';
|
||||
import { load, save } from 'redux-localstorage-simple';
|
||||
import { initReducers } from '../reducers';
|
||||
@@ -13,11 +12,11 @@ const localStorageConfig: RLSOptions = {
|
||||
namespaceSeparator: '.',
|
||||
debounce: 300,
|
||||
};
|
||||
const preloadedState = migrateDeprecatedSettings(load(localStorageConfig) as ShlinkState);
|
||||
const getStateFromLocalStorage = () => migrateDeprecatedSettings(load(localStorageConfig) as ShlinkState);
|
||||
|
||||
export const setUpStore = (container: IContainer) => configureStore({
|
||||
export const setUpStore = (preloadedState = getStateFromLocalStorage()) => configureStore({
|
||||
devTools: !isProduction,
|
||||
reducer: initReducers(container),
|
||||
reducer: initReducers(),
|
||||
preloadedState,
|
||||
middleware: (defaultMiddlewaresIncludingReduxThunk) =>
|
||||
defaultMiddlewaresIncludingReduxThunk({ immutableCheck: false, serializableCheck: false }) // State is too big for these
|
||||
|
||||
Reference in New Issue
Block a user