Skip to content

Commit

Permalink
Fix: Changed Payload Content type where required
Browse files Browse the repository at this point in the history
  • Loading branch information
SmitGala committed Jan 17, 2025
1 parent 6dea053 commit 69facc4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ENV from 'irene/config/environment';
import parseError from 'irene/utils/parse-error';
import type DatetimeService from 'irene/services/datetime';
import type IreneAjaxService from 'irene/services/ajax';
import type { AjaxError } from 'irene/services/ajax';
import { buildURLEncodedFormData, type AjaxError } from 'irene/services/ajax';

const localeStrings = {
en: 'English',
Expand Down Expand Up @@ -67,7 +67,10 @@ export default class AccountSettingsGeneralSelectLanguageComponent extends Compo
};

try {
await this.ajax.post(ENV.endpoints['lang'] as string, { data });
await this.ajax.post(ENV.endpoints['lang'] as string, {
data: buildURLEncodedFormData(data),
contentType: 'application/x-www-form-urlencoded',
});

if (!this.isDestroyed) {
window.location.reload();
Expand Down
11 changes: 10 additions & 1 deletion app/components/file-details/static-scan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,16 @@ export default class FileDetailsStaticScan extends Component<FileDetailsStaticSc
file_id: this.args.file.id,
};

await this.ajax.post(ENV.endpoints['rescan'] as string, { data });
const url = [
ENV.endpoints['files'],
this.args.file.id,
ENV.endpoints['rescan'],
].join('/');

await this.ajax.post(url, {
namespace: ENV.namespace_v2,
data,
});

this.notify.info(this.tRescanInitiated);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module('Integration | Component | file-details/static-scan', function (hooks) {
});

if (isStaticDone) {
this.server.post('/rescan', () => {});
this.server.post('/v2/files/:id/rescan', () => {});
}

await render(hbs`<FileDetails::StaticScan @file={{this.file}} />`);
Expand Down

0 comments on commit 69facc4

Please sign in to comment.