Skip to content

Commit

Permalink
[chores] Updated API endpoint for OpenWISP
Browse files Browse the repository at this point in the history
  • Loading branch information
pandafy committed Jan 3, 2024
1 parent 63396b5 commit 64941a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 5 additions & 2 deletions server/controllers/user-upgrade-plan-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ const userUpgradePlan = (req, res) => {
// merge default config and custom config
const conf = merge(defaultConfig, org);
const {host} = conf;
const userUpgradePlanUrl = reverse("upgrade_plan", getSlug(conf));
const userUpgradePlanUrl = reverse(
"user_plan_radius_usage",
getSlug(conf),
);
const timeout = conf.timeout * 1000;
// make AJAX request
axios({
method: "post",
method: "put",
headers: {
"content-type": "application/json",
Authorization: req.headers.authorization,
Expand Down
4 changes: 1 addition & 3 deletions server/utils/openwisp-urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const paths = {
verify_mobile_phone_token: "/account/phone/verify",
mobile_phone_number_change: "/account/phone/change",
plans: "/plan",
upgrade_plan: "/account/plan/upgrade",
payment_status: "/payment/{paymentId}/status",
};

Expand All @@ -27,8 +26,7 @@ const reverse = (name, orgSlug) => {
if (
name === "plans" ||
name === "payment_status" ||
name === "user_plan_radius_usage" ||
name === "upgrade_plan"
name === "user_plan_radius_usage"
) {
prefix = prefix.replace("/radius/", "/subscriptions/");
}
Expand Down

0 comments on commit 64941a7

Please sign in to comment.