Skip to content

Commit

Permalink
apps/budgeting: remove own_votes filter from url when session is ende…
Browse files Browse the repository at this point in the history
…d - fixes #5010
  • Loading branch information
fuzzylogic2000 committed Mar 2, 2023
1 parent 6406cf4 commit d321b08
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions meinberlin/apps/budgeting/assets/EndSessionLink.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'
import django from 'django'
import Modal from 'adhocracy4/adhocracy4/static/Modal'
import { useSearchParams } from 'react-router-dom'

export const EndSessionLink = (props) => {
const translations = {
Expand All @@ -10,6 +11,7 @@ export const EndSessionLink = (props) => {
modalBodyQuestion: django.gettext('Do you want to end the session?'),
modalCancel: django.gettext('Cancel')
}
const [queryParams, setQueryParams] = useSearchParams()

const modalPartials = {
title: translations.endSession,
Expand All @@ -18,6 +20,10 @@ export const EndSessionLink = (props) => {
}

const handleEndSession = () => {
// remove own_votes from url parameters when session is ended
queryParams.delete('own_votes')
setQueryParams(queryParams)

const endSessionUrl = props.endSessionUrl
fetch(endSessionUrl)
.then(() => window.location.reload(true))
Expand Down

0 comments on commit d321b08

Please sign in to comment.