Skip to content

Commit

Permalink
adapters/crate: Fix query parameter name (#10385)
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 authored Jan 14, 2025
1 parent 19c80e0 commit a5944f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 4 additions & 4 deletions app/adapters/crate.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ export default class CrateAdapter extends ApplicationAdapter {
return `${baseUrl}/${crateName}`;
}

/** Adds a `reason` query parameter to the URL, if set in the `adapterOptions`. */
/** Adds a `message` query parameter to the URL, if set in the `adapterOptions`. */
urlForDeleteRecord(id, modelName, snapshot) {
let url = super.urlForDeleteRecord(...arguments);

let reason = snapshot.adapterOptions.reason;
if (reason) {
url += `?reason=${encodeURIComponent(reason)}`;
let message = snapshot.adapterOptions.message;
if (message) {
url += `?message=${encodeURIComponent(message)}`;
}

return url;
Expand Down
4 changes: 1 addition & 3 deletions app/controllers/crate/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ export default class CrateSettingsController extends Controller {
}

deleteTask = task(async () => {
let { reason } = this;

try {
await this.model.destroyRecord({ adapterOptions: { reason } });
await this.model.destroyRecord({ adapterOptions: { message: this.reason } });
this.notifications.success(`Crate ${this.model.name} has been successfully deleted.`);
this.router.transitionTo('index');
} catch (error) {
Expand Down

0 comments on commit a5944f4

Please sign in to comment.