discourse/app/assets/javascripts/admin/addon/adapters/web-hook-event.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
618 B
JavaScript
Raw Normal View History

import RestAdapter from "discourse/adapters/rest";
export default class WebHookEvent extends RestAdapter {
basePath() {
return "/admin/api/";
}
appendQueryParams(path, findArgs, extension) {
const urlSearchParams = new URLSearchParams();
for (const [key, value] of Object.entries(findArgs)) {
if (value && key !== "webhookId") {
urlSearchParams.set(key, value);
}
}
const queryString = urlSearchParams.toString();
let url = `${path}/${findArgs.webhookId}${extension || ""}`;
if (queryString) {
url = `${url}?${queryString}`;
}
return url;
}
}