code7-leia 0.1.82 → 0.1.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,13 +3,10 @@ import createSagaMiddleware from 'redux-saga';
3
3
  import FilesReducer from './modules/Files/Files.reducer';
4
4
  import FilesSagas from './modules/Files/Files.sagas';
5
5
 
6
- // Criando o middleware de saga
7
6
  const sagaMiddleware = createSagaMiddleware();
8
7
 
9
- // Criando o store com o middleware de saga
10
8
  const store = createStore(FilesReducer, applyMiddleware(sagaMiddleware));
11
9
 
12
- // Inicializando as sagas
13
10
  sagaMiddleware.run(FilesSagas);
14
11
 
15
12
  export default store;
@@ -8,10 +8,10 @@ export const getFilesAction = (payload: string) => {
8
8
  }
9
9
  }
10
10
 
11
- export const getFilesActionSuccess = (data: []) => {
12
- console.log('------------getFilesActionSuccess------------->', data)
11
+ export const getFilesActionSuccess = ({ files }: any) => {
12
+ console.log('------------getFilesActionSuccess------------->', files)
13
13
  return {
14
14
  type: types.GET_FILES_SUCCESS,
15
- payload: data
15
+ payload: { files }
16
16
  }
17
17
  }
@@ -11,7 +11,7 @@ export default function filesReducer(state = INITIAL_STATE, action: any) {
11
11
  switch (action.type) {
12
12
  case types.GET_FILES_SUCCESS:
13
13
  console.log('PAYLOAD: ', action.payload)
14
- draft.files = action.payload;
14
+ draft.files = action.payload.files;
15
15
  break;
16
16
  default:
17
17
  return action.payload;
@@ -5,10 +5,10 @@ import { getFilesActionSuccess } from './Files.actions'
5
5
 
6
6
  export function* getFilesSaga(action: any) {
7
7
  try {
8
- const { id } = action.payload;
9
- const { data } = yield call(api.get, `/files/${id}`);
8
+ console.log('action.payload', action.payload)
9
+ const { data } = yield call(api.get, `/files/${action.payload}`);
10
10
  console.log('-----------getFiles------------------->', data.files);
11
- yield put(getFilesActionSuccess(data.files));
11
+ yield put(getFilesActionSuccess({ files: data.files}));
12
12
  } catch (error) {
13
13
  console.log('-----------getFiles.error------------------->', error);
14
14
  }