code7-leia 0.1.71 → 0.1.73
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.
- package/dist/code7-leia.cjs.development.js +67 -89
- package/dist/code7-leia.cjs.development.js.map +1 -1
- package/dist/code7-leia.cjs.production.min.js +1 -1
- package/dist/code7-leia.cjs.production.min.js.map +1 -1
- package/dist/code7-leia.esm.js +68 -90
- package/dist/code7-leia.esm.js.map +1 -1
- package/dist/store/index.d.ts +7 -4
- package/dist/store/modules/Files/Files.actions.d.ts +10 -1
- package/dist/store/modules/Files/Files.reducer.d.ts +3 -1
- package/dist/store/modules/Files/Files.sagas.d.ts +6 -1
- package/package.json +5 -2
- package/src/Leia.tsx +1 -4
- package/src/components/FileArea/index.tsx +7 -5
- package/src/index.tsx +5 -1
- package/src/store/index.ts +10 -8
- package/src/store/modules/Files/Files.actions.ts +7 -0
- package/src/store/modules/Files/Files.reducer.ts +12 -8
- package/src/store/modules/Files/Files.sagas.ts +5 -7
package/src/store/index.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { createStore
|
|
2
|
-
import
|
|
1
|
+
import { createStore } from 'redux';
|
|
2
|
+
// import { configureStore } from '@reduxjs/toolkit'
|
|
3
|
+
import { persistStore } from 'redux-persist';
|
|
3
4
|
import FilesReducer from './modules/Files/Files.reducer';
|
|
4
|
-
import { FileData } from '../interface/FileData'
|
|
5
|
+
// import { FileData } from '../interface/FileData'
|
|
5
6
|
|
|
6
|
-
const rootReducer = combineReducers({
|
|
7
|
-
|
|
8
|
-
});
|
|
7
|
+
// const rootReducer = combineReducers({
|
|
8
|
+
// files: FilesReducer as unknown as [FileData],
|
|
9
|
+
// });
|
|
9
10
|
|
|
10
|
-
const store = createStore(
|
|
11
|
+
const store = createStore(FilesReducer);
|
|
12
|
+
const persistor = persistStore(store);
|
|
11
13
|
|
|
12
|
-
export { store };
|
|
14
|
+
export { store, persistor };
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
import { produce } from 'immer';
|
|
2
|
+
|
|
1
3
|
const initState = {
|
|
2
4
|
files: []
|
|
3
5
|
}
|
|
4
6
|
|
|
5
7
|
export default function filesReducer(state = initState, action: any) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
return produce(state, (draft: { files: []; }) => {
|
|
9
|
+
switch (action.type) {
|
|
10
|
+
case 'GET_FILES_SUCCESS':
|
|
11
|
+
console.log('PAYLOAD: ', action.payload)
|
|
12
|
+
draft.files = action.payload;
|
|
13
|
+
break;
|
|
14
|
+
default:
|
|
15
|
+
return action.payload;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
14
18
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { takeLatest, all } from 'redux-saga/effects';
|
|
1
|
+
import { takeLatest, all, put, call } from 'redux-saga/effects';
|
|
2
2
|
import api from '../../../service/Api'
|
|
3
3
|
import Types from './Files.types'
|
|
4
|
-
|
|
4
|
+
import { getFilesActionSuccess } from './Files.actions'
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
const { data } =
|
|
8
|
-
|
|
9
|
-
console.log('DATA.FILES ----------------------->', data.files)
|
|
10
|
-
return data.files
|
|
6
|
+
export function* getFiles (id: string) {
|
|
7
|
+
const { data } = yield call(api.get, `/files/${id}`)
|
|
8
|
+
yield put(getFilesActionSuccess(data.files));
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
export default all([
|