Download pool/shard002/JavaScript/0012785_store.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.69 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard002/JavaScript/0012785_store.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard002/JavaScript/0012785_store.js
-
curl -L -o 0012785_store.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard002/JavaScript/0012785_store.js
1.69 kB
| import { configureStore, } from '@reduxjs/toolkit'; | |
| import questionApiReducer from 'ducks/questionApi'; | |
| import appReducer from 'ducks/app'; | |
| import questionApiService from "./services/questionApiService"; | |
| import appServices from "./services/appServices"; | |
| const getMiddleware = () => { | |
| const services = {}; | |
| services.questionApiService = new questionApiService(); | |
| services.appServices = appServices; | |
| return services; | |
| }; | |
| const localStorageMiddleware = ({ getState }) => { | |
| return next => action => { | |
| const result = next(action); | |
| const { app } = getState(); | |
| const toStore = { ...app, dialog: { | |
| children: null, | |
| open: false | |
| }}; | |
| localStorage.setItem('gcaState', JSON.stringify(toStore)); | |
| return result; | |
| }; | |
| }; | |
| const reHydrateStore = () => { | |
| if (localStorage.getItem('gcaState') !== null) { | |
| const app = JSON.parse(localStorage.getItem('gcaState')); | |
| return { | |
| app | |
| } | |
| } | |
| }; | |
| export default configureStore({ | |
| reducer: { | |
| questionApi: questionApiReducer, | |
| app: appReducer | |
| }, | |
| preloadedState: reHydrateStore(), | |
| middleware: getDefaultMiddleware => | |
| getDefaultMiddleware({ | |
| thunk: { | |
| extraArgument: getMiddleware() | |
| }, | |
| serializableCheck: { | |
| // Ignore these action types | |
| ignoredActions: ['gca/questionApi/init/fulfilled','app/setDialog'], | |
| ignoredActionPaths: ['payload.disable', 'payload.children.$$typeof', 'app.dialog.children.$$typeof'] | |
| } | |
| }).concat(localStorageMiddleware), | |
| devTools: true | |
| }); | |