Browse Source

refactor(nocodb): json stringify if input is object only

pull/5168/head
Wing-Kam Wong 2 years ago
parent
commit
5b126c8977
  1. 6
      packages/nocodb/src/lib/models/Hook.ts
  2. 7
      packages/nocodb/src/lib/models/Plugin.ts

6
packages/nocodb/src/lib/models/Hook.ts

@ -155,10 +155,8 @@ export default class Hook implements HookType {
| 'update'; | 'update';
} }
if (insertObj.notification) { if (insertObj.notification && typeof insertObj.notification === 'object') {
insertObj.notification && typeof insertObj.notification === 'object' insertObj.notification = JSON.stringify(insertObj.notification);
? JSON.stringify(insertObj.notification)
: insertObj.notification;
} }
if (!(hook.project_id && hook.base_id)) { if (!(hook.project_id && hook.base_id)) {

7
packages/nocodb/src/lib/models/Plugin.ts

@ -59,11 +59,8 @@ export default class Plugin implements PluginType {
public static async update(pluginId: string, plugin: Partial<PluginType>) { public static async update(pluginId: string, plugin: Partial<PluginType>) {
const updateObj = extractProps(plugin, ['input', 'active']); const updateObj = extractProps(plugin, ['input', 'active']);
if (updateObj.input) { if (updateObj.input && typeof updateObj.input === 'object') {
updateObj.input = updateObj.input = JSON.stringify(updateObj.input);
updateObj.input && typeof updateObj.input === 'object'
? JSON.stringify(updateObj.input)
: updateObj.input;
} }
// get existing cache // get existing cache

Loading…
Cancel
Save