adminforth 1.13.0-next.26 → 1.13.0-next.27

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,4 +1,5 @@
1
- import AdminForth, { AdminForthDataTypes, AdminForthResourceInput } from 'adminforth';
1
+ import AdminForth, { AdminForthDataTypes, AdminForthResourceInput, AdminForthResource, AdminUser } from 'adminforth';
2
+
2
3
  import type { AdminUser } from 'adminforth';
3
4
 
4
5
  async function canModifyUsers({ adminUser }: { adminUser: AdminUser }): Promise<boolean> {
@@ -86,18 +87,19 @@ export default {
86
87
  ],
87
88
  hooks: {
88
89
  create: {
89
- beforeSave: async ({ record, adminUser, resource }) => {
90
- record.password_hash = await AdminForth.Utils.generatePasswordHash(record.password);
90
+ beforeSave: async ({ record, adminUser, resource }: { record: any, adminUser: AdminUser, resource: AdminForthResource }) => {
91
+ record.passwordHash = await AdminForth.Utils.generatePasswordHash(record.password);
91
92
  return { ok: true };
92
93
  }
93
94
  },
94
95
  edit: {
95
- beforeSave: async ({ record, adminUser, resource }) => {
96
- if (record.password) {
97
- record.password_hash = await AdminForth.Utils.generatePasswordHash(record.password);
96
+ beforeSave: async ({ updates, adminUser, resource }: { updates: any, adminUser: AdminUser, resource: AdminForthResource }) => {
97
+ console.log('Updating user', updates);
98
+ if (updates.password) {
99
+ updates.passwordHash = await AdminForth.Utils.generatePasswordHash(updates.password);
98
100
  }
99
101
  return { ok: true }
100
102
  },
101
103
  },
102
- }
104
+ },
103
105
  } as AdminForthResourceInput;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.13.0-next.26",
3
+ "version": "1.13.0-next.27",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",