@ssplib/react-components 0.0.86 → 0.0.88
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.
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export default function FileUpload({ name, tipoArquivo, title, required, multiple, apiURL, xs, sm, md,
|
|
2
|
+
export default function FileUpload({ name, tipoArquivo, title, required, multiple, apiURL, xs, sm, md, }: {
|
|
3
3
|
name: string;
|
|
4
4
|
tipoArquivo: string;
|
|
5
|
-
clientDelete?: boolean;
|
|
6
5
|
title: string;
|
|
7
6
|
apiURL: string;
|
|
8
7
|
required?: boolean;
|
|
@@ -38,7 +38,7 @@ const lodash_get_1 = __importDefault(require("lodash.get"));
|
|
|
38
38
|
const react_1 = __importStar(require("react"));
|
|
39
39
|
const auth_1 = require("../../../context/auth");
|
|
40
40
|
const form_1 = require("../../../context/form");
|
|
41
|
-
function FileUpload({ name, tipoArquivo, title, required = false, multiple = false, apiURL, xs = 12, sm, md,
|
|
41
|
+
function FileUpload({ name, tipoArquivo, title, required = false, multiple = false, apiURL, xs = 12, sm, md, }) {
|
|
42
42
|
const context = (0, react_1.useContext)(form_1.FormContext);
|
|
43
43
|
const { user } = (0, react_1.useContext)(auth_1.AuthContext);
|
|
44
44
|
const [files, setFiles] = (0, react_1.useState)([]);
|
|
@@ -88,8 +88,8 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
|
|
|
88
88
|
}),
|
|
89
89
|
]);
|
|
90
90
|
}, [files, context]);
|
|
91
|
-
const deleteFile = (
|
|
92
|
-
if (
|
|
91
|
+
const deleteFile = (e, id) => {
|
|
92
|
+
if (filesError.includes(id)) {
|
|
93
93
|
setFiles(files.filter((x) => x.id !== id));
|
|
94
94
|
context.setFilesUid((fId) => fId.filter((idd) => idd.CO_SEQ_ARQUIVO !== id));
|
|
95
95
|
return;
|
|
@@ -107,7 +107,7 @@ function FileUpload({ name, tipoArquivo, title, required = false, multiple = fal
|
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
}
|
|
110
|
+
};
|
|
111
111
|
(0, react_1.useEffect)(() => {
|
|
112
112
|
const dt = new DataTransfer();
|
|
113
113
|
files.forEach((x) => {
|
|
@@ -126,10 +126,12 @@ function OAuthProvider({ children, AUTH_URL, oidcConfig, redirectURL, validateTo
|
|
|
126
126
|
}
|
|
127
127
|
function logout() {
|
|
128
128
|
setUserLoaded(false);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
router.replace(logoutURL).finally(() => {
|
|
130
|
+
setUser(null);
|
|
131
|
+
(0, cookies_next_1.deleteCookie)(exports.cookieName);
|
|
132
|
+
localStorage.removeItem(userImgName);
|
|
133
|
+
setUserLoaded(true);
|
|
134
|
+
});
|
|
133
135
|
}
|
|
134
136
|
return react_1.default.createElement(auth_1.AuthContext.Provider, { value: { user, isAuth, userLoaded, login, adLogin: () => { }, logout, saveUserData, type: 'govbr' } }, children);
|
|
135
137
|
}
|