diff --git a/src/frontend/site.js b/src/frontend/site.js index e17b8222..c945e6fc 100644 --- a/src/frontend/site.js +++ b/src/frontend/site.js @@ -24,6 +24,7 @@ const adManagerRouter = require('./controller/adManager'); const cheerio = require('cheerio'); const express = require('express'); const router = express.Router(); +const querystring = require("querystring"); // Global Timeline route router.get('/', showGlobalTimeline); @@ -373,11 +374,28 @@ function unlikePost(req, res) { } function postMembership(req, res) { - const membership = {userid: getJwtUserId(req.cookies), membership: req.body.membershipText}; - fetchUsingDeploymentBase(req, () => req.MEMBERSHIP_SERVICE_API.post('/', membership)).then((response) => { - res.redirect(extendURL(`/user/${getJwtUser(req.cookies)}`)); - }, (error) => res.status(statusCodeForError(error)).render('error.njk', handleError(error))); - + const formData = { + membership: req.body.membershipText, + }; + fetchUsingDeploymentBase(req, () => + req.MEMBERSHIP_SERVICE_API.post( + `/add/${getJwtUserId(req.cookies)}`, + querystring.stringify(formData), + { + headers: { + "Content-Type": "application/x-www-form-urlencoded", + }, + } + ) + ).then( + (response) => { + res.redirect(extendURL(`/user/${getJwtUser(req.cookies)}`)); + }, + (error) => + res + .status(statusCodeForError(error)) + .render("error.njk", handleError(error)) + ); } function postBio(req, res) { diff --git a/src/frontend/views/membership.njk b/src/frontend/views/membership.njk index e3b429ee..f5d34d31 100644 --- a/src/frontend/views/membership.njk +++ b/src/frontend/views/membership.njk @@ -1,4 +1,4 @@ -{# +{# Copyright 2023 Dynatrace LLC Licensed under the Apache License, Version 2.0 (the "License"); @@ -48,6 +48,7 @@ limitations under the License. +
{% endblock %}