Skip to content

Commit

Permalink
Clear API after saving admin session
Browse files Browse the repository at this point in the history
  • Loading branch information
lwesterhof committed Nov 6, 2024
1 parent f610695 commit 42111c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion admin/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from werkzeug.utils import secure_filename

import api
from cache_config import clear_view_cache_keys
from cache_config import clear_api_cache_keys, clear_view_cache_keys
from util import get_theme_directories, length_check

# Blueprint configuration
Expand Down Expand Up @@ -177,6 +177,7 @@ def save_settings(settings: Dict[str, Any], flash_msg: str) -> Response:
set_theme_loader(app, remove_cache=True)

clear_view_cache_keys(all_users=True)
clear_api_cache_keys("admin_save_settings")
flash(flash_msg, 'success')

return redirect(url_for("admin_bp.index"))
Expand Down
2 changes: 2 additions & 0 deletions cache_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@

# API cache clear configuration.
API_CACHE_CLEAR = {
"admin_save_settings": {"type": "global", "endpoints": ["vault_get_publication_terms",
"vault_preservable_formats_lists"]},
"group_create": {"type": "global", "endpoints": ["group_data"]},
"group_update": {"type": "global", "endpoints": ["group_data"]},
"group_delete": {"type": "global", "endpoints": ["group_data"]},
Expand Down

0 comments on commit 42111c9

Please sign in to comment.