code7-leia 0.1.72 → 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 +45 -68
- 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 +46 -69
- package/dist/code7-leia.esm.js.map +1 -1
- 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 +2 -1
- package/src/components/FileArea/index.tsx +7 -5
- 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
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
export declare function getFilesAction(id: string): {
|
|
2
2
|
type: string;
|
|
3
|
-
payload:
|
|
3
|
+
payload: Generator<import("redux-saga/effects").CallEffect<unknown> | import("redux-saga/effects").PutEffect<{
|
|
4
|
+
type: string;
|
|
5
|
+
payload: [];
|
|
6
|
+
}>, void, {
|
|
7
|
+
data: any;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
export declare function getFilesActionSuccess(data: []): {
|
|
11
|
+
type: string;
|
|
12
|
+
payload: [];
|
|
4
13
|
};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function getFiles(id: string): Generator<import("redux-saga/effects").CallEffect<unknown> | import("redux-saga/effects").PutEffect<{
|
|
2
|
+
type: string;
|
|
3
|
+
payload: [];
|
|
4
|
+
}>, void, {
|
|
5
|
+
data: any;
|
|
6
|
+
}>;
|
|
2
7
|
declare const _default: import("redux-saga/effects").AllEffect<import("redux-saga/effects").ForkEffect<never>>;
|
|
3
8
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.73",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"@reduxjs/toolkit": "^2.2.1",
|
|
71
71
|
"axios": "^1.6.7",
|
|
72
72
|
"classcat": "^5.0.4",
|
|
73
|
+
"immer": "^10.0.4",
|
|
73
74
|
"react-dropzone": "^14.2.3",
|
|
74
75
|
"react-icons": "^5.0.1",
|
|
75
76
|
"react-redux": "^9.1.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState} from 'react';
|
|
2
|
-
import { useDispatch } from 'react-redux';
|
|
2
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
3
3
|
|
|
4
4
|
import { FaUpload, FaList, FaPlus } from 'react-icons/fa';
|
|
5
5
|
|
|
@@ -27,7 +27,7 @@ export const FileArea = () => {
|
|
|
27
27
|
const { id, language } = useSharedProps();
|
|
28
28
|
const t = getLanguage(language)
|
|
29
29
|
const dispatch = useDispatch();
|
|
30
|
-
|
|
30
|
+
const initFiles = useSelector((state: any) => state.files);
|
|
31
31
|
const tags = [
|
|
32
32
|
"pae",
|
|
33
33
|
"boteria",
|
|
@@ -41,9 +41,11 @@ export const FileArea = () => {
|
|
|
41
41
|
dispatch(getFilesAction(id))
|
|
42
42
|
}, [])
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
console.log(initFiles)
|
|
46
|
+
setFiles(initFiles)
|
|
47
|
+
setInitialFiles(initFiles)
|
|
48
|
+
}, [initFiles])
|
|
47
49
|
|
|
48
50
|
useEffect(() => {
|
|
49
51
|
console.log('language, id: ', language, id)
|
|
@@ -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([
|