This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useEffect, useMemo} from 'react'; | |
import {shallowEqual, useDispatch, useSelector} from 'react-redux'; | |
import {getBundle} from './redux/actions'; | |
import {bundleSelector} from './redux/selectors'; | |
import PLLoader from '@/components/shared/atoms/PLLoader'; | |
import SingleKpiDelta from '@/components/shared/atoms/SingleKpiDelta'; | |
import SingleKpiSparkline from '@/components/shared/atoms/SingleKpiSparkline'; | |
import SingleKpi from '@/components/shared/atoms/SingleKpi'; | |
import {KPI_TYPE} from '@/interfaces'; | |
import styles from './styles.less'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useEffect, useMemo} from 'react'; | |
import {shallowEqual, useDispatch, useSelector} from 'react-redux'; | |
import {getBundle} from './redux/actions'; | |
import {bundleSelector} from './redux/selectors'; | |
import PLLoader from '@/components/shared/atoms/PLLoader'; | |
import SingleKpiDelta from '@/components/shared/atoms/SingleKpiDelta'; | |
import SingleKpiSparkline from '@/components/shared/atoms/SingleKpiSparkline'; | |
import SingleKpi from '@/components/shared/atoms/SingleKpi'; | |
import {KPI_TYPE} from '@/interfaces'; | |
import styles from './styles.less'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {put, call, cancelled} from 'redux-saga/effects'; | |
function* uploadMediaWorker(action) { | |
const abortController = new AbortController(); | |
try { | |
yield put(actions.uploadMediaStart()); | |
const response = yield call(uploadService.uploadMedia, { | |
signal: abortController.signal, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {cancel} from 'redux-saga/effects'; | |
function* stopUploadMediaWorker(action) { | |
yield cancel(action); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {takeEvery, fork, take} from 'redux-saga/effects'; | |
export default function* watcherSaga() { | |
while (true) { | |
const forkedTask = yield fork(uploadMediaWorker, yield take(types.UPLOAD_MEDIA)); | |
yield takeEvery(types.STOP_UPLOAD_MEDIA, stopUploadMediaWorker, forkedTask); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { useSelector } from 'react-redux'; | |
import ProjectSection from './ProjectSection'; | |
const ProjectList = () => { | |
const projects = useSelector(state => state.projectsReducer.projects); | |
return ( | |
<div> | |
{projects.map(project => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HYDRATE } from 'next-redux-wrapper'; | |
const initialState = { | |
// initial state here ... | |
}; | |
const projectsReducer = (state = initialState, action) => { | |
switch (action.type) { | |
// This will overwrite client state | |
case HYDRATE: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { END } from 'redux-saga'; | |
import { getProjectsWithPosts } from 'components/ProjectList/redux/actions'; | |
import { wrapper } from 'store'; | |
const Projects = () => { | |
return ( | |
<ProjectList /> | |
); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { wrapper } from 'store'; | |
const MyApp = ({ Component, pageProps }) => { | |
return <Component {...pageProps} />; | |
}; | |
export default wrapper.withRedux(MyApp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, applyMiddleware } from 'redux'; | |
import createSagaMiddleware from 'redux-saga'; | |
import { createWrapper } from 'next-redux-wrapper'; | |
import rootReducer from './rootReducer'; | |
import rootSaga from './rootSaga'; | |
export const makeStore = () => { | |
// 1: Create the middleware | |
const sagaMiddleware = createSagaMiddleware(); |
NewerOlder