fix: follow route to match spec

v1.18.x
Julian Lam 5 years ago
parent b5bbcbaeaa
commit db5c5b2cfb

@ -116,7 +116,7 @@ define('forum/account/header', [
function toggleFollow(type) {
$.ajax({
url: config.relative_path + '/api/v1/users/' + ajaxify.data.uid + '/' + type,
url: config.relative_path + '/api/v1/users/' + ajaxify.data.uid + '/follow',
method: type === 'follow' ? 'post' : 'delete',
}).done(function () {
components.get('account/follow').toggleClass('hide', type === 'follow');

@ -30,7 +30,7 @@ function authenticatedRoutes() {
setupApiRoute(router, '/:uid/password', middleware, [...middlewares, middleware.checkRequired.bind(null, ['newPassword'])], 'put', controllers.write.users.changePassword);
setupApiRoute(router, '/:uid/follow', middleware, [...middlewares], 'post', controllers.write.users.follow);
setupApiRoute(router, '/:uid/unfollow', middleware, [...middlewares], 'delete', controllers.write.users.unfollow);
setupApiRoute(router, '/:uid/follow', middleware, [...middlewares], 'delete', controllers.write.users.unfollow);
// app.put('/:uid/follow', apiMiddleware.requireUser, function(req, res) {
// Users.follow(req.user.uid, req.params.uid, function(err) {

Loading…
Cancel
Save