[Glitch] use configureStore of redux-toolkit instead of createStore of redux

Port 8227af8dcc to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
pull/59/head^2^2
fusagiko / takayamaki 2023-05-03 03:39:06 +09:00 committed by Claire
parent bbd0e9caa6
commit f4e3e309b1
2 changed files with 7 additions and 7 deletions

View File

@ -5,7 +5,7 @@ import { IntlProvider, addLocaleData } from 'react-intl';
import { Provider as ReduxProvider } from 'react-redux'; import { Provider as ReduxProvider } from 'react-redux';
import { BrowserRouter, Route } from 'react-router-dom'; import { BrowserRouter, Route } from 'react-router-dom';
import { ScrollContext } from 'react-router-scroll-4'; import { ScrollContext } from 'react-router-scroll-4';
import configureStore from 'flavours/glitch/store/configureStore'; import { store } from 'flavours/glitch/store/configureStore';
import UI from 'flavours/glitch/features/ui'; import UI from 'flavours/glitch/features/ui';
import { fetchCustomEmojis } from 'flavours/glitch/actions/custom_emojis'; import { fetchCustomEmojis } from 'flavours/glitch/actions/custom_emojis';
import { hydrateStore } from 'flavours/glitch/actions/store'; import { hydrateStore } from 'flavours/glitch/actions/store';
@ -20,7 +20,6 @@ addLocaleData(localeData);
const title = process.env.NODE_ENV === 'production' ? siteTitle : `${siteTitle} (Dev)`; const title = process.env.NODE_ENV === 'production' ? siteTitle : `${siteTitle} (Dev)`;
export const store = configureStore();
const hydrateAction = hydrateStore(initialState); const hydrateAction = hydrateStore(initialState);
store.dispatch(hydrateAction); store.dispatch(hydrateAction);

View File

@ -1,15 +1,16 @@
import { createStore, applyMiddleware, compose } from 'redux'; import { configureStore } from '@reduxjs/toolkit';
import thunk from 'redux-thunk'; import thunk from 'redux-thunk';
import appReducer from '../reducers'; import appReducer from '../reducers';
import loadingBarMiddleware from '../middleware/loading_bar'; import loadingBarMiddleware from '../middleware/loading_bar';
import errorsMiddleware from '../middleware/errors'; import errorsMiddleware from '../middleware/errors';
import soundsMiddleware from '../middleware/sounds'; import soundsMiddleware from '../middleware/sounds';
export default function configureStore() { export const store = configureStore({
return createStore(appReducer, compose(applyMiddleware( reducer: appReducer,
middleware: [
thunk, thunk,
loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] }), loadingBarMiddleware({ promiseTypeSuffixes: ['REQUEST', 'SUCCESS', 'FAIL'] }),
errorsMiddleware(), errorsMiddleware(),
soundsMiddleware(), soundsMiddleware(),
), window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : f => f)); ],
} });