Skip to content

Commit

Permalink
Pass PresetId into UpdateRequest
Browse files Browse the repository at this point in the history
- Remove `id` argument, as it is unused in place of the id already in the `updatedActivityPreset` argument
  • Loading branch information
Mythicaeda committed Nov 27, 2023
1 parent f9d961a commit 9c0ac96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/components/activity/ActivityDirectiveForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@
} = event;
if (activityDirective.applied_preset) {
await effects.updateActivityPreset(
activityDirective.applied_preset.preset_id,
{
...activityDirective.applied_preset.preset_applied,
arguments: getDisplayedArguments(),
Expand Down
10 changes: 4 additions & 6 deletions src/utilities/effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3793,20 +3793,18 @@ const effects = {
}
},

async updateActivityPreset(
id: ActivityPresetId,
updatedActivityPreset: ActivityPresetSetInput,
user: User | null,
): Promise<void> {
async updateActivityPreset(updatedActivityPreset: ActivityPresetSetInput, user: User | null): Promise<void> {
try {
if (!queryPermissions.UPDATE_ACTIVITY_PRESET(user, updatedActivityPreset)) {
throwPermissionError('update this activity preset');
}
const { id: _id, ...restOfPresetPayload } = updatedActivityPreset;

const { id: id, ...restOfPresetPayload } = updatedActivityPreset;
const { update_activity_presets_by_pk } = await reqHasura<ActivityPreset>(
gql.UPDATE_ACTIVITY_PRESET,
{
activityPresetSetInput: restOfPresetPayload,
id: id,
},
user,
);
Expand Down

0 comments on commit 9c0ac96

Please sign in to comment.