Skip to content

adapters/crate: Fix query parameter name #10385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading