code7-leia 0.2.5 → 0.2.7

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.
@@ -4,10 +4,10 @@ interface CustomToastContentProps {
4
4
  description?: String;
5
5
  }
6
6
  declare const toast: {
7
- default: ({ title, description }: CustomToastContentProps) => import("react-toastify").Id;
8
- success: ({ title, description }: CustomToastContentProps) => import("react-toastify").Id;
9
- error: ({ title, description }: CustomToastContentProps) => import("react-toastify").Id;
10
- warn: ({ title, description }: CustomToastContentProps) => import("react-toastify").Id;
7
+ default: ({ title, description }: CustomToastContentProps) => React.ReactText;
8
+ success: ({ title, description }: CustomToastContentProps) => React.ReactText;
9
+ error: ({ title, description }: CustomToastContentProps) => React.ReactText;
10
+ warn: ({ title, description }: CustomToastContentProps) => React.ReactText;
11
11
  };
12
12
  declare const ContainerToast: React.FC;
13
13
  export { ContainerToast, toast };
@@ -1,6 +1,6 @@
1
- import { ToastContainer } from 'react-toastify';
1
+ /// <reference types="react" />
2
2
  import 'react-toastify/dist/ReactToastify.css';
3
3
  interface CustomContainerToastProps {
4
4
  }
5
- export declare const CustomContainerToast: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react-toastify").ToastContainerProps, CustomContainerToastProps>> & Pick<typeof ToastContainer, never>;
5
+ export declare const CustomContainerToast: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react-toastify").ToastContainerProps, CustomContainerToastProps>> & Pick<import("react").FC<import("react-toastify").ToastContainerProps>, "propTypes" | "contextTypes" | "defaultProps" | "displayName">;
6
6
  export {};
@@ -1,10 +1,10 @@
1
1
  declare const store: import("redux").Store<{
2
2
  files: never[];
3
3
  message: string;
4
- isLoading: boolean;
4
+ isloading: boolean;
5
5
  isChanging: boolean;
6
6
  isOffline: boolean;
7
- }, any, unknown> & {
7
+ }, any> & {
8
8
  dispatch: unknown;
9
9
  };
10
10
  export default store;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.5",
2
+ "version": "0.2.7",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -92,7 +92,7 @@ export const FileArea = () => {
92
92
  }
93
93
 
94
94
  const handleOpenModalDelete = (name: string) => {
95
- setFileDelete(name + '.pdf')
95
+ setFileDelete(name)
96
96
  setModalDelete(!modalDelete)
97
97
  }
98
98
 
@@ -54,20 +54,24 @@ export function* testSaga(action: any) {
54
54
  }
55
55
 
56
56
  export function* uploadFilesSaga(action: any) {
57
- const t = getLanguage(action.payload.language)
57
+ const t = getLanguage(action.payload.language);
58
58
  try {
59
59
  yield put(commonLoadingStart());
60
60
  const { id, file, pressets, token } = action.payload;
61
- const tags = pressets.join(',');
62
61
 
63
62
  const blob = new Blob([file.content]);
64
-
65
63
  const formData = new FormData();
66
64
  formData.append('file', blob, file.properties.path);
67
65
 
68
- const queryParams = new URLSearchParams({ tags }).toString();
66
+ const queryParams = pressets.length
67
+ ? new URLSearchParams({ tags: pressets.join(',') }).toString()
68
+ : '';
69
+
70
+ const url = queryParams
71
+ ? `/upload/${id}?token=${token}&${queryParams}`
72
+ : `/upload/${id}?token=${token}`;
69
73
 
70
- yield call(api.post, `/upload/${id}?token=${token}&${queryParams}`, formData, {
74
+ yield call(api.post, url, formData, {
71
75
  headers: {
72
76
  'Content-Type': 'multipart/form-data',
73
77
  },
@@ -76,13 +80,17 @@ export function* uploadFilesSaga(action: any) {
76
80
  const { data } = yield call(api.get, `/training/${id}?token=${token}`);
77
81
  yield put(uploadFilesActionSuccess({ files: data.files }));
78
82
  } catch (error) {
79
- toast.error({title: t.toast.uploadFile.fail.title, description: t.toast.uploadFile.fail.description});
83
+ toast.error({
84
+ title: t.toast.uploadFile.fail.title,
85
+ description: t.toast.uploadFile.fail.description,
86
+ });
80
87
  console.log('-----------uploadFilesSaga.error------------------->', error);
81
88
  } finally {
82
89
  yield put(commonLoadingFinish());
83
90
  }
84
91
  }
85
92
 
93
+
86
94
  export function* TrainingSaga(action: any) {
87
95
  const t = getLanguage(action.payload.language)
88
96
  try {
@@ -92,7 +100,7 @@ export function* TrainingSaga(action: any) {
92
100
 
93
101
  const queryParams = new URLSearchParams({ tag }).toString();
94
102
 
95
- yield call(api.post, pressets.length > 0 ? `/training?token=${token}&${queryParams}` : `/training?token=${token}`,{ files_directory: id });
103
+ yield call(api.post, pressets.length > 0 ? `/training?${queryParams}` : `/training`,{ files_directory: id, token });
96
104
 
97
105
  const { data } = yield call(api.get, `/training/${id}?token=${token}`);
98
106
  yield put(uploadFilesActionSuccess({ files: data.files }));