Skip to content

Commit

Permalink
Fix regression in htmx response to theme update
Browse files Browse the repository at this point in the history
  • Loading branch information
elfjes authored Nov 13, 2024
1 parent 0150380 commit 1f57565
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/argus_htmx/themes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.http import HttpResponse
from django_htmx.http import HttpResponseClientRefresh

from argus.auth.utils import get_preference, save_preference
from argus.auth.utils import save_preference

from argus_htmx.constants import THEME_NAMES
from argus_htmx.incidents.views import HtmxHttpRequest
Expand All @@ -23,9 +23,7 @@ def theme_names(request: HtmxHttpRequest) -> HttpResponse:

@require_POST
def change_theme(request: HtmxHttpRequest) -> HttpResponse:
theme = get_preference(request, "argus_htmx", "theme")
success = save_preference(request, request.POST, "argus_htmx", "theme")
if success:
theme = get_preference(request, "argus_htmx", "theme")
return HttpResponse(theme)
return render(request, "htmx/themes/_current_theme.html")
return HttpResponseClientRefresh()

0 comments on commit 1f57565

Please sign in to comment.