@visns-studio/visns-components 4.3.6 → 4.3.8

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.
@@ -78,6 +78,8 @@ const Login = ({ logo, providers, setSystemAuth, setUserProfile }) => {
78
78
  if (e) {
79
79
  e.preventDefault();
80
80
 
81
+ console.info(location.state);
82
+
81
83
  CustomFetch(
82
84
  '/login/authenticate',
83
85
  'POST',
@@ -92,12 +94,8 @@ const Login = ({ logo, providers, setSystemAuth, setUserProfile }) => {
92
94
  if (result.error === '') {
93
95
  setUserProfile(result.user);
94
96
 
95
- if (
96
- result.previous?.state?.referrer &&
97
- result.previous.state.referrer !== ''
98
- ) {
99
- window.location.href =
100
- result.previous.state.referrer;
97
+ if (result.previous && result.previous !== '') {
98
+ window.location.href = result.previous;
101
99
  } else {
102
100
  setSystemAuth(true);
103
101
  }
@@ -19,8 +19,14 @@ import Reset from '../auth/Reset';
19
19
  import Verify from '../auth/Verify';
20
20
 
21
21
  const ProtectedRoute = ({ user, loading, redirectPath = '/login' }) => {
22
+ const location = useLocation();
23
+
22
24
  return loading ? null : !user || !user.id ? (
23
- <Navigate to={redirectPath} replace />
25
+ <Navigate
26
+ to={redirectPath}
27
+ replace
28
+ state={{ previousUrl: location.pathname }}
29
+ />
24
30
  ) : (
25
31
  <Outlet />
26
32
  );
@@ -53,8 +59,12 @@ const GenericAuth = ({
53
59
  } catch (error) {
54
60
  setIsLoading(false);
55
61
  if (['Unauthenticatdata.'].includes(error)) {
62
+ const currentUrl = window.location.pathname;
63
+
64
+ console.info('aaa');
65
+
56
66
  setIsAuthenticated(false);
57
- navigate('/login');
67
+ navigate('/login', { state: { previousUrl: currentUrl } });
58
68
  }
59
69
  }
60
70
  };
@@ -321,6 +321,18 @@ function GenericFormBuilder({ setting, urlParam, userProfile }) {
321
321
  (!field.options || field.options.length === 0)
322
322
  ) {
323
323
  errors.push('Please add options for the dropdown.');
324
+ } else if (
325
+ field.type === 'table_text' &&
326
+ (!field.options || field.options.length === 0)
327
+ ) {
328
+ errors.push('Please add options for the table.');
329
+ } else if (field.type === 'table_radio') {
330
+ if (!field.options || field.options.length === 0) {
331
+ errors.push('Please add options for the table.');
332
+ }
333
+ if (!field.rows || field.rows.length === 0) {
334
+ errors.push('Please add rows for the table.');
335
+ }
324
336
  }
325
337
 
326
338
  if (!field.size || field.size === '') {
package/package.json CHANGED
@@ -57,7 +57,7 @@
57
57
  "react-dom": "^17.0.1"
58
58
  },
59
59
  "name": "@visns-studio/visns-components",
60
- "version": "4.3.6",
60
+ "version": "4.3.8",
61
61
  "description": "Various packages to assist in the development of our Custom Applications.",
62
62
  "main": "index.js",
63
63
  "scripts": {