Skip to content

Commit

Permalink
remove UPDATE_PAYLOAD_DEFAULT
Browse files Browse the repository at this point in the history
  • Loading branch information
vitPinchuk committed Nov 14, 2024
1 parent 9c1ff1b commit 7d345a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
15 changes: 0 additions & 15 deletions src/constants/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,6 @@ export const RESET_CODE_DEFAULT = `console.log(context.panel.data, context.panel
*/
export const INITIAL_PAYLOAD_DEFAULT = `return {}`;

/**
* Update Payload
*/
export const UPDATE_PAYLOAD_DEFAULT = `const payload = {};
context.panel.elements.forEach((element) => {
if (!element.value) {
return;
}
payload[element.id] = element.value;
})
return payload;`;

/**
* Initial Request
*/
Expand Down
5 changes: 2 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import {
SUBMIT_BUTTON_DEFAULT,
UPDATE_CODE_DEFAULT,
UPDATE_ENABLED_OPTIONS,
UPDATE_PAYLOAD_DEFAULT,
UPDATE_REQUEST_METHOD_OPTIONS,
} from './constants';
import { getMigratedOptions } from './migration';
Expand Down Expand Up @@ -464,7 +463,7 @@ export const plugin = new PanelPlugin<PanelOptions>(FormPanel)
type: CodeEditorType.GET_PAYLOAD,
variablesSuggestions: true,
},
defaultValue: UPDATE_PAYLOAD_DEFAULT,
defaultValue: '',
showIf: (config) => isRequestConfigured(config.update) && config.update.payloadMode === PayloadMode.CUSTOM,
})
.addCustomEditor({
Expand All @@ -477,7 +476,7 @@ export const plugin = new PanelPlugin<PanelOptions>(FormPanel)
settings: {
datasourceKey: 'update.datasource',
},
defaultValue: UPDATE_PAYLOAD_DEFAULT,
defaultValue: '',
showIf: (config) =>
isRequestConfigured(config.update) &&
config.update.method === RequestMethod.DATASOURCE &&
Expand Down

0 comments on commit 7d345a8

Please sign in to comment.