@ssplib/react-components 0.0.107 → 0.0.109
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.
|
@@ -47,18 +47,30 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
47
47
|
const { user, userLoaded } = (0, react_1.useContext)(auth_1.AuthContext);
|
|
48
48
|
(0, react_1.useEffect)(() => {
|
|
49
49
|
if (userLoaded || isPublic)
|
|
50
|
-
fetchFunc()
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
else if (j.statusCode === 403)
|
|
50
|
+
fetchFunc()
|
|
51
|
+
.then((res) => {
|
|
52
|
+
if (!res.ok)
|
|
54
53
|
setError({
|
|
55
|
-
status:
|
|
54
|
+
status: 500,
|
|
56
55
|
});
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
return res.json().then((j) => {
|
|
57
|
+
if (j.statusCode === 204)
|
|
58
|
+
setData({ body: { data: [] } });
|
|
59
|
+
else if (j.statusCode === 403)
|
|
60
|
+
setError({
|
|
61
|
+
status: j.statusCode,
|
|
62
|
+
});
|
|
63
|
+
else
|
|
64
|
+
setData(j);
|
|
65
|
+
console.log(j.statusCode);
|
|
66
|
+
setIsLoading(false);
|
|
67
|
+
});
|
|
68
|
+
})
|
|
69
|
+
.catch((err) => {
|
|
70
|
+
setError({
|
|
71
|
+
status: 500,
|
|
72
|
+
});
|
|
73
|
+
});
|
|
62
74
|
}, [userLoaded]);
|
|
63
75
|
const [list, setList] = (0, react_1.useState)([]);
|
|
64
76
|
//numero de items pra ser mostrado
|
|
@@ -272,7 +284,9 @@ function Table({ columns, fetchFunc, emptyMsg = {
|
|
|
272
284
|
}, [data]);
|
|
273
285
|
if (error)
|
|
274
286
|
return (react_1.default.createElement(material_1.Box, { bgcolor: '#E2E8F0', padding: 2, marginX: 2 },
|
|
275
|
-
react_1.default.createElement(Typography_1.default, { fontSize: 24, textAlign: 'center', fontFamily: 'Inter' },
|
|
287
|
+
react_1.default.createElement(Typography_1.default, { fontSize: 24, textAlign: 'center', fontFamily: 'Inter' },
|
|
288
|
+
error.status === 403 && 'Acesso negado',
|
|
289
|
+
error.status === 500 && (react_1.default.createElement(material_1.Box, { fontWeight: 500, textAlign: 'center' }, "Lamentavelmente, ocorreu um imprevisto em nosso servidor. Pedimos a sua compreens\u00E3o e solicitamos que aguarde por um momento enquanto verificamos a situa\u00E7\u00E3o.")))));
|
|
276
290
|
if (isLoading)
|
|
277
291
|
return (react_1.default.createElement(material_1.Stack, { sx: { height: '100%', width: '100%' }, justifyContent: 'center', alignItems: 'center' },
|
|
278
292
|
react_1.default.createElement(Typography_1.default, { fontWeight: 600, fontSize: 20, paddingBottom: 2, marginTop: 14 },
|
package/components/page/Login.js
CHANGED
|
@@ -62,7 +62,7 @@ function Login({ imgURL = '', name = 'Login', children, loginURL, captchaSiteKey
|
|
|
62
62
|
captchaSiteKey && (React.createElement(react_google_recaptcha_1.default, { ref: captcha, hl: 'pt', sitekey: captchaSiteKey, onExpired: () => setCaptchaSolved(false), onChange: (e) => {
|
|
63
63
|
setCaptchaToken(e), e && setCaptchaSolved(true);
|
|
64
64
|
} })),
|
|
65
|
-
React.createElement(lab_1.LoadingButton, { type: 'submit', fullWidth: true, variant: 'contained', loading: loading, disabled: !captchaSolved }, "Login"),
|
|
65
|
+
React.createElement(lab_1.LoadingButton, { type: 'submit', fullWidth: true, variant: 'contained', loading: loading, disabled: !!captchaSiteKey ? !captchaSolved : false }, "Login"),
|
|
66
66
|
error && (React.createElement(Box_1.default, { bgcolor: '#ce4257', padding: 2, borderRadius: 2, color: 'white' },
|
|
67
67
|
React.createElement(Typography_1.default, null, "Dados incorretos. Tente novamente!"))))))));
|
|
68
68
|
}
|