@galadrim/galadmin 0.1.151 → 0.1.152

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.
@@ -135,7 +135,7 @@ export type CreateType = {
135
135
  };
136
136
  export type CustomAction = {
137
137
  label: string;
138
- action: (record: any) => void;
138
+ action: (record: any) => void | string;
139
139
  successMessage?: string;
140
140
  };
141
141
  export type FormDataFile = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galadrim/galadmin",
3
- "version": "0.1.151",
3
+ "version": "0.1.152",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
package/src/api.ts CHANGED
@@ -562,7 +562,13 @@ export default (db, config, user) => {
562
562
  try {
563
563
  const { rows } = await db.query("SELECT " + (view.selectExpression || "*") + " FROM ?? " + (view.join || "") + " WHERE ?? = ?", [view.tableName, view.tableName + "." + view.primaryId, recordId])
564
564
  const record = rows[0]
565
- await action.action(record);
565
+ const actionResult = await action.action(record);
566
+ if (actionResult) {
567
+ return res.send({
568
+ success: true,
569
+ message: actionResult
570
+ })
571
+ }
566
572
  } catch (err) {
567
573
  console.error(err)
568
574
  return res.send({
@@ -162,7 +162,7 @@ export type CreateType = {
162
162
 
163
163
  export type CustomAction = {
164
164
  label: string;
165
- action: (record: any) => void;
165
+ action: (record: any) => void | string;
166
166
  successMessage?: string;
167
167
  };
168
168