refactor/update consent deletion URL in views.py

This commit is contained in:
Hongwei 2025-05-28 15:20:06 +02:00
parent 62b1fd8cf9
commit eeaf73529b

View File

@ -49,10 +49,9 @@ class RevokeConsents(LoginRequiredMixin, View):
"""Deletes consent from API"""
api = API(self.request.session.get('obp'))
try:
urlpath = '/my/consent/current'
consent_id= kwargs['consent_id']
headers = {'Consent-Id': consent_id}
response = api.delete(urlpath, settings.API_VERSION['v510'], headers=headers)
urlpath = '/my/consents/{}'.format(consent_id)
response = api.delete(urlpath, settings.API_VERSION['v510'])
if 'code' in response and response['code'] >= 400:
messages.error(self.request, response['message'])
else: