diff --git a/controllers/teams.js b/controllers/teams.js index eec8174bc6..7b1535c6dd 100644 --- a/controllers/teams.js +++ b/controllers/teams.js @@ -291,6 +291,7 @@ router.get('/', async (req, res, next) => { team.background = team.color; team.memberAmount = team.userIds.length; team.id = team._id; + team.url = `/teams/invitation/accept/${team._id}`; return team; }); @@ -1200,7 +1201,7 @@ router.get('/invitation/accept/:teamId', async (req, res, next) => { der Nutzer hat nicht die Rechte oder ist schon Mitglied des Teams. `, err, ); - res.redirect('/teams/'); + res.redirect(`/teams/${req.params.teamId}`); }); }); diff --git a/static/scripts/teamOverview.js b/static/scripts/teamOverview.js index a992c6d200..b78e6c130f 100644 --- a/static/scripts/teamOverview.js +++ b/static/scripts/teamOverview.js @@ -1,21 +1,4 @@ $(document).ready(() => { - $('.section-teamInvitations a').click(function handler(e) { - e.stopPropagation(); - e.preventDefault(); - - const id = $(this).parents('.sc-card-wrapper').data('id'); - - $.ajax({ - url: `/teams/invitation/accept/${id}`, - method: 'GET', - }).done(() => { - $.showNotification('Einladung erfolgreich angenommen', 'success', true); - location.reload(); - }).fail(() => { - $.showNotification('Problem beim Akzeptieren der Einladung', 'danger', true); - }); - }); - $('.btn-member').on('click', function (e) { e.stopPropagation(); e.preventDefault();