Add publisher dashboard routes
This commit is contained in:
parent
96551c2788
commit
e4a5246ab3
31 changed files with 1603 additions and 516 deletions
26
repub/web/admin/pages/settings.py
Normal file
26
repub/web/admin/pages/settings.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Awaitable, Callable
|
||||
from typing import Any
|
||||
|
||||
from datastar_py.quart import DatastarResponse
|
||||
from quart import Quart, Response
|
||||
|
||||
from repub.web.app import _page_patch_response, _shim_page_response, render_settings
|
||||
|
||||
RouteGuard = Callable[[Callable[..., Awaitable[Any]]], Callable[..., Awaitable[Any]]]
|
||||
|
||||
|
||||
def register_settings_routes(app: Quart, *, admin_required: RouteGuard) -> None:
|
||||
@app.get("/admin/settings")
|
||||
@admin_required
|
||||
async def admin_settings_home() -> Response:
|
||||
return _shim_page_response(
|
||||
current_path="/admin/settings",
|
||||
static_prefix="/admin",
|
||||
)
|
||||
|
||||
@app.post("/admin/settings")
|
||||
@admin_required
|
||||
async def admin_settings_patch() -> DatastarResponse:
|
||||
return await _page_patch_response(app, lambda _tab_id: render_settings(app))
|
||||
Loading…
Add table
Add a link
Reference in a new issue