express-sweet-generator 2.0.5 → 2.0.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.
- package/README.md +8 -8
- package/bin/express-sweet-cli.js +4 -4
- package/package.json +1 -1
- package/templates/cjs/config/config.js +6 -6
- package/templates/cjs/errors/NotFoundError.js +14 -0
- package/templates/cjs/models/UserModel.js +6 -6
- package/templates/cjs/public/build/editPersonal.js +105 -105
- package/templates/cjs/public/build/login.js +7 -7
- package/templates/cjs/public/build/users.js +198 -189
- package/templates/cjs/routes/api/users.js +27 -27
- package/templates/client/src/api/UserApi.js +1 -1
- package/templates/client/src/editPersonal.js +3 -3
- package/templates/client/src/login.js +2 -2
- package/templates/client/src/modals/UserModal.js +5 -5
- package/templates/client/src/shared/Api.js +4 -4
- package/templates/client/src/shared/reloadDataTableWithDelay.js +12 -0
- package/templates/client/src/users.js +4 -8
- package/templates/esm/config/config.js +6 -6
- package/templates/esm/errors/NotFoundError.js +14 -0
- package/templates/esm/models/UserModel.js +6 -6
- package/templates/esm/public/build/editPersonal.js +105 -105
- package/templates/esm/public/build/login.js +7 -7
- package/templates/esm/public/build/users.js +198 -189
- package/templates/esm/routes/api/users.js +27 -27
- package/templates/cjs/exceptions/UserNotFound.js +0 -6
- package/templates/esm/exceptions/UserNotFound.js +0 -6
|
@@ -124,13 +124,13 @@ var build = __webpack_require__(236);
|
|
|
124
124
|
/**
|
|
125
125
|
* Handles API errors.
|
|
126
126
|
* @param {number} code The HTTP status code.
|
|
127
|
-
* @param {Error}
|
|
127
|
+
* @param {Error} error The error object.
|
|
128
128
|
* @return {void}
|
|
129
129
|
*/
|
|
130
|
-
errorHook(code,
|
|
130
|
+
errorHook(code, error) {
|
|
131
131
|
// Check if the error object and request properties exist to avoid runtime errors
|
|
132
|
-
if (
|
|
133
|
-
const {pathname} = new URL(
|
|
132
|
+
if (error && error.request && error.request.responseURL) {
|
|
133
|
+
const {pathname} = new URL(error.request.responseURL);
|
|
134
134
|
if (pathname !== '/api/users/login' && code === 401) {
|
|
135
135
|
// Redirect to the login page if an authentication error occurs on a non-login request.
|
|
136
136
|
location.replace('/');
|
|
@@ -141,7 +141,7 @@ var build = __webpack_require__(236);
|
|
|
141
141
|
;// CONCATENATED MODULE: ./src/api/UserApi.js
|
|
142
142
|
|
|
143
143
|
|
|
144
|
-
/* harmony default export */ const UserApi = (class extends
|
|
144
|
+
/* harmony default export */ const UserApi = (class extends Api {
|
|
145
145
|
constructor() {
|
|
146
146
|
super('/api/users');
|
|
147
147
|
}
|
|
@@ -205,10 +205,10 @@ function initForm() {
|
|
|
205
205
|
if (!data)
|
|
206
206
|
return void validation.setError('email', 'userNotFound');
|
|
207
207
|
location.href = '/';
|
|
208
|
-
} catch (
|
|
208
|
+
} catch (error) {
|
|
209
209
|
validation.offIndicator();
|
|
210
210
|
build.components.Dialog.unknownError();
|
|
211
|
-
throw
|
|
211
|
+
throw error;
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
214
|
}
|