express-sweet-generator 2.0.12 → 2.0.14

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.
Files changed (38) hide show
  1. package/README.md +8 -4
  2. package/package.json +1 -1
  3. package/templates/cjs/bin/www.ejs +3 -3
  4. package/templates/cjs/models/UserModel.js +9 -1
  5. package/templates/cjs/public/build/login.js +3 -7
  6. package/templates/{esm/public/build/editPersonal.js → cjs/public/build/profile-edit.js} +115 -105
  7. package/templates/cjs/public/build/users.js +185 -185
  8. package/templates/cjs/routes/api/profile.js +29 -0
  9. package/templates/cjs/routes/api/users.js +0 -18
  10. package/templates/cjs/routes/profile.js +16 -0
  11. package/templates/cjs/routes/users.js +1 -12
  12. package/templates/cjs/views/layout/default.hbs +4 -4
  13. package/templates/{esm/views/edit-personal.hbs → cjs/views/profile/edit.hbs} +4 -4
  14. package/templates/{esm/views/personal.hbs → cjs/views/profile/show.hbs} +1 -1
  15. package/templates/client/src/api/ProfileApi.js +22 -0
  16. package/templates/client/src/api/UserApi.js +36 -4
  17. package/templates/client/src/login.js +16 -4
  18. package/templates/client/src/modals/UserModal.js +3 -3
  19. package/templates/client/src/{editPersonal.js → profile-edit.js} +21 -7
  20. package/templates/client/src/users.js +26 -10
  21. package/templates/client/webpack.config.js +1 -1
  22. package/templates/esm/bin/www.ejs +3 -3
  23. package/templates/esm/models/UserModel.js +9 -1
  24. package/templates/esm/public/build/login.js +3 -7
  25. package/templates/{cjs/public/build/editPersonal.js → esm/public/build/profile-edit.js} +115 -105
  26. package/templates/esm/public/build/users.js +185 -185
  27. package/templates/esm/routes/api/profile.js +29 -0
  28. package/templates/esm/routes/api/users.js +0 -18
  29. package/templates/esm/routes/profile.js +16 -0
  30. package/templates/esm/routes/users.js +1 -12
  31. package/templates/esm/views/layout/default.hbs +4 -4
  32. package/templates/{cjs/views/edit-personal.hbs → esm/views/profile/edit.hbs} +4 -4
  33. package/templates/{cjs/views/personal.hbs → esm/views/profile/show.hbs} +1 -1
  34. /package/templates/cjs/public/build/{editPersonal.css → profile-edit.css} +0 -0
  35. /package/templates/cjs/views/{users.hbs → users/index.hbs} +0 -0
  36. /package/templates/client/src/{editPersonal.css → profile-edit.css} +0 -0
  37. /package/templates/esm/public/build/{editPersonal.css → profile-edit.css} +0 -0
  38. /package/templates/esm/views/{users.hbs → users/index.hbs} +0 -0
@@ -0,0 +1,29 @@
1
+ const express = require('express');
2
+ // const expressExtension = require('express-sweet');
3
+ const {body} = require('express-validator');
4
+ const UserModel = require('../../models/UserModel');
5
+ const NotFoundError = require('../../errors/NotFoundError');
6
+ const isValidImageDataUrl = require('../../validators/isValidImageDataUrl');
7
+ const checkValidationResult = require('../../middlewares/checkValidationResult');
8
+
9
+ const router = express.Router();
10
+
11
+ router.put('/', [
12
+ body('user.email').trim().not().isEmpty().isEmail(),
13
+ body('user.name').trim().not().isEmpty().isLength({max: 30}),
14
+ body('user.password').trim().optional({nullable: true, checkFalsy: true}).isLength({max: 128}),
15
+ body('user.icon').not().isEmpty().custom(isValidImageDataUrl),
16
+ checkValidationResult,
17
+ ], async (req, res, next) => {
18
+ try {
19
+ await UserModel.updateUser(req.user.id, req.body.user);
20
+ res.json(true);
21
+ } catch (error) {
22
+ if (error instanceof NotFoundError)
23
+ res.json({error: error.name});
24
+ else
25
+ next(error);
26
+ }
27
+ });
28
+
29
+ module.exports = router;
@@ -84,22 +84,4 @@ router.delete('/:userId(\\d+)', async (req, res) => {
84
84
  res.json(true);
85
85
  });
86
86
 
87
- router.put('/profile', [
88
- body('user.email').trim().not().isEmpty().isEmail(),
89
- body('user.name').trim().not().isEmpty().isLength({max: 30}),
90
- body('user.password').trim().optional({nullable: true, checkFalsy: true}).isLength({max: 128}),
91
- body('user.icon').not().isEmpty().custom(isValidImageDataUrl),
92
- checkValidationResult,
93
- ], async (req, res, next) => {
94
- try {
95
- await UserModel.updateUser(req.user.id, req.body.user);
96
- res.json(true);
97
- } catch (error) {
98
- if (error instanceof NotFoundError)
99
- res.json({error: error.name});
100
- else
101
- next(error);
102
- }
103
- });
104
-
105
87
  module.exports = router;
@@ -0,0 +1,16 @@
1
+ const express = require('express');
2
+ const UserModel = require('../models/UserModel');
3
+
4
+ const router = express.Router();
5
+
6
+ router.get('/', async (req, res) => {
7
+ const user = await UserModel.getUser(req.user.id);
8
+ res.render('profile/show', {user: user.toJSON()});
9
+ });
10
+
11
+ router.get('/edit', async (req, res) => {
12
+ const user = await UserModel.getUser(req.user.id);
13
+ res.render('profile/edit', {user: user.toJSON()});
14
+ });
15
+
16
+ module.exports = router;
@@ -1,20 +1,9 @@
1
1
  const express = require('express');
2
- const UserModel = require('../models/UserModel');
3
2
 
4
3
  const router = express.Router();
5
4
 
6
5
  router.get('/', (req, res) => {
7
- res.render('users');
8
- });
9
-
10
- router.get('/personal', async (req, res) => {
11
- const user = await UserModel.getUser(req.user.id);
12
- res.render('personal', {user: user.toJSON()});
13
- });
14
-
15
- router.get('/edit-personal', async (req, res) => {
16
- const user = await UserModel.getUser(req.user.id);
17
- res.render('edit-personal', {user: user.toJSON()});
6
+ res.render('users/index');
18
7
  });
19
8
 
20
9
  module.exports = router;
@@ -112,9 +112,9 @@
112
112
  </div>
113
113
  <!--end:Menu item-->
114
114
  <!--begin:Menu item-->
115
- <div class="menu-item menu-here-bg me-0 me-lg-2 {{#if (eq currentPath '/users/personal')}}here{{/if}}">
115
+ <div class="menu-item menu-here-bg me-0 me-lg-2 {{#if (eq currentPath '/profile')}}here{{/if}}">
116
116
  <!--begin:Menu link-->
117
- <a class="menu-link" href="/users/personal">
117
+ <a class="menu-link" href="/profile">
118
118
  <span class="menu-title">Profile Settings</span>
119
119
  </a>
120
120
  <!--end:Menu link-->
@@ -233,7 +233,7 @@
233
233
  <!--end::Menu separator-->
234
234
  <!--begin::Menu item-->
235
235
  <div class="menu-item px-5">
236
- <a href="/users/personal" class="menu-link px-5">Profile Settings</a>
236
+ <a href="/profile" class="menu-link px-5">Profile Settings</a>
237
237
  </div>
238
238
  <!--end::Menu item-->
239
239
  <!--begin::Menu item-->
@@ -337,7 +337,7 @@
337
337
  <!--begin:Menu item-->
338
338
  <div class="menu-item">
339
339
  <!--begin:Menu link-->
340
- <a class="menu-link {{#if (or (eq currentPath '/users/personal') (eq currentPath '/users/edit-personal'))}}active{{/if}}" href="/users/personal">
340
+ <a class="menu-link {{#if (or (eq currentPath '/profile') (eq currentPath '/profile/edit'))}}active{{/if}}" href="/profile">
341
341
  <span class="menu-icon">
342
342
  <i class="ki-duotone ki-address-book fs-2">
343
343
  <span class="path1"></span>
@@ -1,14 +1,14 @@
1
1
  {{!< default}}
2
2
  {{#contentFor 'title'}}Edit personal settings{{/contentFor}}
3
- {{#contentFor 'style'}}<link rel="stylesheet" type="text/css" href="{{cacheBusting '/build/editPersonal.css' ''}}">{{/contentFor}}
4
- {{#contentFor 'script'}}<script src="{{cacheBusting '/build/editPersonal.js' ''}}"></script>{{/contentFor}}
3
+ {{#contentFor 'style'}}<link rel="stylesheet" type="text/css" href="{{cacheBusting '/build/profile-edit.css' ''}}">{{/contentFor}}
4
+ {{#contentFor 'script'}}<script src="{{cacheBusting '/build/profile-edit.js' ''}}"></script>{{/contentFor}}
5
5
  <input data-ref="user.iconPath" type="hidden" value="{{user.icon}}">
6
6
  <input data-ref="user.modified" type="hidden" value="{{formatDate 'x' user.modified}}">
7
7
 
8
8
  <!--begin::Basic info-->
9
9
  <div class="card mb-5 mb-xl-10">
10
10
  <!--begin::Form-->
11
- <form data-ref="personalForm" class="form" novalidate="novalidate">
11
+ <form data-ref="profileEditForm" class="form" novalidate="novalidate">
12
12
  <!--begin::Card body-->
13
13
  <div class="card-body p-9">
14
14
  <!--begin::Input group-->
@@ -85,7 +85,7 @@
85
85
  <!--end::Card body-->
86
86
  <!--begin::Actions-->
87
87
  <div class="card-footer d-flex justify-content-end py-6 px-9">
88
- <a href="/users/personal" class="btn btn-light btn-active-light-primary me-2">Back to Profile</a>
88
+ <a href="/profile" class="btn btn-light btn-active-light-primary me-2">Back to Profile</a>
89
89
  <button type="submit" class="btn btn-primary">Update Profile</button>
90
90
  </div>
91
91
  <!--end::Actions-->
@@ -5,7 +5,7 @@
5
5
  <!--begin::Card header-->
6
6
  <div class="card-header cursor-pointer justify-content-end">
7
7
  <!--begin::Action-->
8
- <a href="/users/edit-personal" class="btn btn-primary align-self-center">Edit Profile</a>
8
+ <a href="/profile/edit" class="btn btn-primary align-self-center">Edit Profile</a>
9
9
  <!--end::Action-->
10
10
  </div>
11
11
  <!--end::Card header-->
@@ -0,0 +1,22 @@
1
+ import Api from '~/shared/Api';
2
+
3
+ /**
4
+ * API client for user profile operations.
5
+ */
6
+ export default class extends Api {
7
+ /**
8
+ * Creates a new instance of this API client.
9
+ */
10
+ constructor() {
11
+ super('/api/profile');
12
+ }
13
+
14
+ /**
15
+ * Updates the user's profile.
16
+ * @param {FormData} formData The form data containing the updated profile information.
17
+ * @return {Promise<object>} The API response.
18
+ */
19
+ async updateProfile(formData) {
20
+ return this.client.put('/', formData);
21
+ }
22
+ }
@@ -1,35 +1,67 @@
1
1
  import Api from '~/shared/Api';
2
2
 
3
+ /**
4
+ * API client for user management operations.
5
+ */
3
6
  export default class extends Api {
7
+ /**
8
+ * Creates a new instance of this API client.
9
+ */
4
10
  constructor() {
5
11
  super('/api/users');
6
12
  }
7
13
 
14
+ /**
15
+ * Logs in a user.
16
+ * @param {FormData} formData The form data containing the user's login credentials.
17
+ * @return {Promise<object>} The API response.
18
+ */
8
19
  async login(formData) {
9
20
  return this.client.post('login', formData);
10
21
  }
11
22
 
23
+ /**
24
+ * Logs out the current user.
25
+ * @return {void}
26
+ */
12
27
  async logout() {
13
28
  location.assign('/api/users/logout');
14
29
  }
15
30
 
31
+ /**
32
+ * Creates a new user.
33
+ * @param {FormData} formData The form data containing the new user's information.
34
+ * @return {Promise<object>} The API response.
35
+ */
16
36
  async createUser(formData) {
17
37
  return this.client.post('/', formData);
18
38
  }
19
39
 
40
+ /**
41
+ * Retrieves a user by ID.
42
+ * @param {number} userId The ID of the user to retrieve.
43
+ * @return {Promise<object>} The API response.
44
+ */
20
45
  async getUser(userId) {
21
46
  return this.client.get(`/${userId}`);
22
47
  }
23
48
 
49
+ /**
50
+ * Updates a user by ID.
51
+ * @param {number} userId The ID of the user to update.
52
+ * @param {FormData} formData - The form data containing the updated user information.
53
+ * @return {Promise<object>} The API response.
54
+ */
24
55
  async updateUser(userId, formData) {
25
56
  return this.client.put(`/${userId}`, formData);
26
57
  }
27
58
 
59
+ /**
60
+ * Deletes a user by ID.
61
+ * @param {number} userId The ID of the user to delete.
62
+ * @return {Promise<object>} The API response.
63
+ */
28
64
  async deleteUser(userId) {
29
65
  return this.client.delete(`/${userId}`);
30
66
  }
31
-
32
- async updateProfile(formData) {
33
- return this.client.put('/profile', formData);
34
- }
35
67
  }
@@ -1,8 +1,11 @@
1
- import '~/login.css';
2
1
  import {components} from 'metronic-extension';
3
2
  import UserApi from '~/api/UserApi';
3
+ import '~/login.css';
4
4
 
5
- function initValidation() {
5
+ /**
6
+ * Initializes form validation.
7
+ */
8
+ const initValidation = () => {
6
9
  validation = new components.Validation(ref.loginForm.get(0), {
7
10
  email: {
8
11
  validators: {
@@ -19,7 +22,10 @@ function initValidation() {
19
22
  });
20
23
  }
21
24
 
22
- function initForm() {
25
+ /**
26
+ * Handles form events.
27
+ */
28
+ const handleForm = () => {
23
29
  validation.onValid(async () => {
24
30
  try {
25
31
  validation.onIndicator();
@@ -37,7 +43,13 @@ function initForm() {
37
43
  }
38
44
 
39
45
  const userApi = new UserApi();
46
+
47
+ // Get references to elements with data-ref attributes.
40
48
  const ref = components.selectRef();
49
+
50
+ // Initializes form validation.
41
51
  let validation;
42
52
  initValidation();
43
- initForm();
53
+
54
+ // Handles form events.
55
+ handleForm();
@@ -48,10 +48,10 @@ export default class extends components.Modal {
48
48
  this.#mode = mode;
49
49
  this.#userId = userId;
50
50
 
51
- // Get elements.
51
+ // Get references to elements with data-ref attributes.
52
52
  this.#ref = components.selectRef(super.element);
53
53
 
54
- // Form validation initialization.
54
+ // Initializes form validation.
55
55
  this.#initValidation();
56
56
 
57
57
  // Image input component initialization.
@@ -284,7 +284,7 @@ export default class extends components.Modal {
284
284
  }
285
285
 
286
286
  /**
287
- * Form validation initialization.
287
+ * Initializes form validation.
288
288
  */
289
289
  #initValidation() {
290
290
  this.#validator = new components.Validation(this.#ref.form.get(0), {
@@ -1,9 +1,13 @@
1
- import '~/editPersonal.css';
2
1
  import {components, utils} from 'metronic-extension';
2
+ import ProfileApi from '~/api/ProfileApi';
3
3
  import UserApi from '~/api/UserApi';
4
+ import '~/profile-edit.css';
4
5
 
5
- function initValidation() {
6
- validation = new components.Validation(ref.personalForm.get(0), {
6
+ /**
7
+ * Initializes form validation.
8
+ */
9
+ const initValidation = () => {
10
+ validation = new components.Validation(ref.profileEditForm.get(0), {
7
11
  'user[email]': {
8
12
  validators: {
9
13
  notEmpty: {message: 'Email is required.'},
@@ -43,11 +47,14 @@ function initValidation() {
43
47
  });
44
48
  }
45
49
 
46
- function initForm() {
50
+ /**
51
+ * Handles form events.
52
+ */
53
+ const handleForm = () => {
47
54
  validation.onValid(async () => {
48
55
  try {
49
56
  validation.onIndicator();
50
- const {data} = await userApi.updateProfile(new FormData(validation.form));
57
+ const {data} = await profileApi.updateProfile(new FormData(validation.form));
51
58
  validation.offIndicator();
52
59
  if (data.error)
53
60
  if (data.error === 'NotFoundError') {
@@ -67,7 +74,7 @@ function initForm() {
67
74
  throw error;
68
75
  }
69
76
  });
70
- ref.personalForm
77
+ ref.profileEditForm
71
78
  .on('show.bs.collapse hide.bs.collapse', '#passwordCollapse', evnt => {
72
79
  if (evnt.type === 'show') {
73
80
  validation.enableValidator('user[password]');
@@ -96,9 +103,16 @@ function initForm() {
96
103
  });
97
104
  }
98
105
 
106
+ const profileApi = new ProfileApi();
99
107
  const userApi = new UserApi();
108
+
109
+ // Get references to elements with data-ref attributes.
100
110
  const ref = components.selectRef('#kt_app_content_container');
101
111
  const originalEmail = utils.trim(ref.user.email.val(), true);
112
+
113
+ // Initializes form validation.
102
114
  let validation;
103
115
  initValidation();
104
- initForm();
116
+
117
+ // Handles form events.
118
+ handleForm();
@@ -1,30 +1,35 @@
1
- import '~/users.css';
2
1
  import hbs from 'handlebars-extd';
3
2
  import {components} from 'metronic-extension';
4
3
  import Datatable from '~/shared/Datatable';
5
4
  import reloadDataTableWithDelay from '~/shared/reloadDataTableWithDelay';
6
5
  import UserApi from '~/api/UserApi';
7
6
  import UserModal from '~/modals/UserModal';
7
+ import '~/users.css';
8
8
 
9
- function initTable() {
9
+ /**
10
+ * Initializes the data table.
11
+ */
12
+ const initDatatable = () => {
13
+ let targetIndex = 0;
10
14
  userTable = new Datatable(ref.userTable, {
11
15
  ajax: {
12
16
  url: '/api/users',
13
17
  data: d => {
18
+ // Set filter parameters.
14
19
  d.search = ref.keyword.val()
15
20
  }
16
21
  },
17
22
  dom: `<'row'<'col-12 dataTables_pager'p>><'row'<'col-12'tr>><'row'<'col-12 dataTables_pager'p>>`,
18
23
  columnDefs: [
19
- {targets: 0, data: 'name', className: 'd-flex align-items-center', render: (data, type, row) => hbs.compile(
24
+ {targets: targetIndex++, data: 'name', className: 'd-flex align-items-center', render: (data, type, row) => hbs.compile(
20
25
  `<div class="symbol symbol-35px me-3">
21
26
  <img src="{{row.icon}}?{{formatDate 'x' row.modified}}">
22
27
  </div>
23
28
  <span class="text-gray-800">{{row.name}}</span>`)({row})
24
29
  },
25
- {targets: 1, data: 'email'},
26
- {targets: 2, data: 'modified', render: data => hbs.compile(`{{formatDate 'YYYY/M/D HH:mm:ss' data}}`)({data})},
27
- {targets: -1, className: 'text-end', data: 'actions', orderable: false, render: (data, type, row) =>
30
+ {targets: targetIndex++, data: 'email'},
31
+ {targets: targetIndex++, data: 'modified', render: data => hbs.compile(`{{formatDate 'YYYY/M/D HH:mm:ss' data}}`)({data})},
32
+ {targets: targetIndex++, className: 'text-end', data: 'actions', orderable: false, render: (data, type, row) =>
28
33
  hbs.compile(
29
34
  `<button data-on-update-user data-id="{{row.id}}" data-bs-toggle="tooltip" data-bs-dismiss="click" title="Update user." type="button" class="btn btn-sm btn-icon btn-light btn-icon-gray-800 btn-active-light-primary me-3">
30
35
  <!--begin::Svg Icon | path: icons/duotune/general/gen019.svg-->
@@ -51,11 +56,16 @@ function initTable() {
51
56
  {{/if}}`)({row})
52
57
  }
53
58
  ],
54
- order: [[0, 'asc']]
59
+ order: [
60
+ [0, 'asc'],
61
+ ]
55
62
  });
56
63
  }
57
64
 
58
- function initForm() {
65
+ /**
66
+ * Handles form events.
67
+ */
68
+ const handleForm = () => {
59
69
  $('body')
60
70
  .on('click', '[data-on-create-user]', async () => {
61
71
  if (await userModal.show('create') !== false)
@@ -98,7 +108,13 @@ function initForm() {
98
108
 
99
109
  const userApi = new UserApi();
100
110
  const userModal = new UserModal();
111
+
112
+ // Get references to elements with data-ref attributes.
101
113
  const ref = components.selectRef('#kt_app_content_container');
102
114
  let userTable;
103
- initTable();
104
- initForm();
115
+
116
+ // Initialize the data table.
117
+ initDatatable();
118
+
119
+ // Handles form events.
120
+ handleForm();
@@ -17,7 +17,7 @@ module.exports = {
17
17
  app: './src/app.js',
18
18
  login: './src/login.js',
19
19
  users: './src/users.js',
20
- editPersonal: './src/editPersonal.js'
20
+ 'profile-edit': './src/profile-edit.js'
21
21
  },
22
22
  output: {
23
23
  path: path.resolve(__dirname, '../public/build'),
@@ -9,7 +9,7 @@ import app from '../app.js';
9
9
  /**
10
10
  * Normalize a port into a number, string, or false.
11
11
  */
12
- function normalizePort(val) {
12
+ const normalizePort = val => {
13
13
  var port = parseInt(val, 10);
14
14
  // named pipe
15
15
  if (isNaN(port)) return val;
@@ -22,7 +22,7 @@ function normalizePort(val) {
22
22
  /**
23
23
  * Event listener for HTTP server "error" event.
24
24
  */
25
- function onError(error) {
25
+ const onError = error => {
26
26
  if (error.syscall !== 'listen')
27
27
  throw error;
28
28
  const bind = typeof port === 'string' ? `Pipe ${port}` : `Port ${port}`;
@@ -45,7 +45,7 @@ function onError(error) {
45
45
  /**
46
46
  * Event listener for HTTP server "listening" event.
47
47
  */
48
- function onListening() {
48
+ const onListening = () => {
49
49
  const addr = server.address();
50
50
  const bind = typeof addr === 'string' ? `pipe ${addr}` : `port ${addr.port}`;
51
51
  debug(`Listening on ${bind}`);
@@ -68,8 +68,10 @@ export default class extends expressExtension.database.Model {
68
68
  search: null,
69
69
  }, paginationOptions);
70
70
 
71
+ // Calculate total records.
71
72
  const recordsTotal = await super.count();
72
73
 
74
+ // Where clause for filtering data.
73
75
  const whereClause = {};
74
76
  if (paginationOptions.search)
75
77
  whereClause[super.Op.or] = [
@@ -77,12 +79,16 @@ export default class extends expressExtension.database.Model {
77
79
  {name: {[super.Op.like]: `%${paginationOptions.search}%`}}
78
80
  ];
79
81
 
82
+ // Calculate filtered records.
80
83
  const recordsFiltered = await super.count({where: whereClause});
81
84
 
85
+ // Fetch paginated data.
82
86
  const data = await super.findAll({
83
87
  attributes: ['id', 'name', 'email', 'icon', 'modified'],
84
88
  where: whereClause,
85
- order: [[paginationOptions.order, paginationOptions.dir]],
89
+ order: [
90
+ [super.col(paginationOptions.order), paginationOptions.dir],
91
+ ],
86
92
  offset: parseInt(paginationOptions.start, 10),
87
93
  limit: parseInt(paginationOptions.length),
88
94
  raw: true
@@ -163,6 +169,7 @@ export default class extends expressExtension.database.Model {
163
169
  }
164
170
 
165
171
  static async emailExists(email, excludeUserId = null) {
172
+ // Where clause for filtering data.
166
173
  const whereClause = {email};
167
174
  if (excludeUserId)
168
175
  whereClause.id = {[super.Op.ne]: excludeUserId};
@@ -170,6 +177,7 @@ export default class extends expressExtension.database.Model {
170
177
  }
171
178
 
172
179
  static async userIdExists(userId) {
180
+ // Where clause for filtering data.
173
181
  const whereClause = {email};
174
182
  if (excludeUserId)
175
183
  whereClause.id = {[super.Op.ne]: excludeUserId};
@@ -169,17 +169,13 @@ var build = __webpack_require__(236);
169
169
  async deleteUser(userId) {
170
170
  return this.client.delete(`/${userId}`);
171
171
  }
172
-
173
- async updateProfile(formData) {
174
- return this.client.put('/profile', formData);
175
- }
176
172
  });
177
173
  ;// CONCATENATED MODULE: ./src/login.js
178
174
 
179
175
 
180
176
 
181
177
 
182
- function initValidation() {
178
+ const initValidation = () => {
183
179
  validation = new build.components.Validation(ref.loginForm.get(0), {
184
180
  email: {
185
181
  validators: {
@@ -196,7 +192,7 @@ function initValidation() {
196
192
  });
197
193
  }
198
194
 
199
- function initForm() {
195
+ const handleForm = () => {
200
196
  validation.onValid(async () => {
201
197
  try {
202
198
  validation.onIndicator();
@@ -217,7 +213,7 @@ const userApi = new UserApi();
217
213
  const ref = build.components.selectRef();
218
214
  let validation;
219
215
  initValidation();
220
- initForm();
216
+ handleForm();
221
217
  })();
222
218
 
223
219
  /******/ })()