code7-leia 0.1.92 → 0.1.93
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 +107 -16
- 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 +107 -16
- package/dist/code7-leia.esm.js.map +1 -1
- package/dist/interface/Language.d.ts +1 -0
- package/dist/store/modules/Files/Files.actions.d.ts +13 -0
- package/dist/store/modules/Files/Files.sagas.d.ts +8 -0
- package/dist/store/modules/Files/Files.types.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/FileArea/index.tsx +34 -5
- package/src/components/FileArea/styles.tsx +6 -0
- package/src/interface/Language.ts +1 -0
- package/src/store/modules/Files/Files.actions.ts +14 -0
- package/src/store/modules/Files/Files.reducer.ts +3 -0
- package/src/store/modules/Files/Files.sagas.ts +14 -2
- package/src/store/modules/Files/Files.types.ts +3 -1
- package/src/utils/getLanguage.tsx +3 -0
|
@@ -12,4 +12,18 @@ export const getFilesActionSuccess = ({ files }: any) => {
|
|
|
12
12
|
type: types.GET_FILES_SUCCESS,
|
|
13
13
|
payload: { files }
|
|
14
14
|
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const deleteFilesAction = (name: string, id: string) => {
|
|
18
|
+
return {
|
|
19
|
+
type: types.DELETE_FILES_REQUEST,
|
|
20
|
+
payload: { name, id }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const deleteFilesActionSuccess = ({ files }: any) => {
|
|
25
|
+
return {
|
|
26
|
+
type: types.DELETE_FILES_SUCCESS,
|
|
27
|
+
payload: { files }
|
|
28
|
+
}
|
|
15
29
|
}
|
|
@@ -11,6 +11,9 @@ export default function filesReducer(state = INITIAL_STATE, action: any) {
|
|
|
11
11
|
case types.GET_FILES_SUCCESS:
|
|
12
12
|
draft.files = action.payload.files;
|
|
13
13
|
break;
|
|
14
|
+
case types.DELETE_FILES_SUCCESS:
|
|
15
|
+
draft.files = action.payload.files;
|
|
16
|
+
break;
|
|
14
17
|
default:
|
|
15
18
|
return action.payload;
|
|
16
19
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
import { getFilesActionSuccess } from './Files.actions'
|
|
4
|
+
import { getFilesActionSuccess, deleteFilesActionSuccess } from './Files.actions'
|
|
5
5
|
|
|
6
6
|
export function* getFilesSaga(action: any) {
|
|
7
7
|
try {
|
|
@@ -13,8 +13,20 @@ export function* getFilesSaga(action: any) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export function* deleteFilesSaga(action: any) {
|
|
17
|
+
try {
|
|
18
|
+
const { id, name } = action.payload
|
|
19
|
+
yield call(api.delete, `/delete/${id}/${name}`);
|
|
20
|
+
const { data } = yield call(api.get, `/files/${id}`);
|
|
21
|
+
yield put(deleteFilesActionSuccess({ files: data.files}));
|
|
22
|
+
} catch (error) {
|
|
23
|
+
console.log('-----------getFiles.error------------------->', error);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
16
27
|
export default function* filesSagas() {
|
|
17
28
|
yield all([
|
|
18
|
-
takeLatest(Types.GET_FILES_REQUEST, getFilesSaga)
|
|
29
|
+
takeLatest(Types.GET_FILES_REQUEST, getFilesSaga),
|
|
30
|
+
takeLatest(Types.DELETE_FILES_REQUEST, deleteFilesSaga)
|
|
19
31
|
]);
|
|
20
32
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const Types = {
|
|
2
2
|
GET_FILES_REQUEST: '@files/GET_FILES_REQUEST',
|
|
3
|
-
GET_FILES_SUCCESS: '@files/GET_FILES_SUCCESS'
|
|
3
|
+
GET_FILES_SUCCESS: '@files/GET_FILES_SUCCESS',
|
|
4
|
+
DELETE_FILES_REQUEST: '@files/DELETE_FILES_REQUEST',
|
|
5
|
+
DELETE_FILES_SUCCESS: '@files/DELETE_FILES_SUCCESS'
|
|
4
6
|
};
|
|
5
7
|
|
|
6
8
|
export default Types;
|
|
@@ -19,6 +19,7 @@ const defaultLanguage: Language = {
|
|
|
19
19
|
descriptionUpload: 'Drag and drop files here or',
|
|
20
20
|
chooseFile: 'Choose a file',
|
|
21
21
|
uploadFile: 'Upload a file',
|
|
22
|
+
deleteFile: 'Important! By deleting this file, you will lose all its information and will not be able to recover it.'
|
|
22
23
|
},
|
|
23
24
|
},
|
|
24
25
|
buttons: {
|
|
@@ -61,6 +62,7 @@ export const getLanguage = (language: keyof Record<'en' | 'pt-br' | 'es', Langua
|
|
|
61
62
|
descriptionUpload: 'Arraste e solte os arquivos aqui ou',
|
|
62
63
|
chooseFile: 'Escolha um arquivo',
|
|
63
64
|
uploadFile: 'Enviar um arquivo',
|
|
65
|
+
deleteFile: 'Importante! Ao deletar esse arquivo você perderá todas as informações dele e não terá como recuperá-las.'
|
|
64
66
|
},
|
|
65
67
|
},
|
|
66
68
|
buttons: {
|
|
@@ -102,6 +104,7 @@ export const getLanguage = (language: keyof Record<'en' | 'pt-br' | 'es', Langua
|
|
|
102
104
|
...defaultLanguage.fileArea.modal,
|
|
103
105
|
descriptionUpload: 'Arrastre y suelte los archivos aquí o',
|
|
104
106
|
chooseFile: 'Elegir un archivo',
|
|
107
|
+
deleteFile: '¡Importante! Al borrar este archivo perderás toda la información contenida en él y no podrás recuperarla.'
|
|
105
108
|
},
|
|
106
109
|
},
|
|
107
110
|
buttons: {
|