diff --git a/api/advent22_api/routers/admin.py b/api/advent22_api/routers/admin.py index 93b1ca0..c2edc32 100644 --- a/api/advent22_api/routers/admin.py +++ b/api/advent22_api/routers/admin.py @@ -7,16 +7,16 @@ from ..core.calendar_config import CalendarConfig, get_calendar_config from ..core.config import Config, get_config from ..core.depends import shuffle_solution from ..core.settings import SETTINGS -from ._security import require_admin +from ._security import user_is_admin router = APIRouter(prefix="/admin", tags=["admin"]) -@router.get("/check") -async def check_admin( - _: None = Depends(require_admin), +@router.get("/is_admin") +async def is_admin( + is_admin: bool = Depends(user_is_admin), ) -> bool: - return True + return is_admin class ConfigModel(BaseModel): diff --git a/ui/src/App.vue b/ui/src/App.vue index 28226b3..8589e79 100644 --- a/ui/src/App.vue +++ b/ui/src/App.vue @@ -1,17 +1,18 @@ @@ -33,18 +34,7 @@ import DoorMapEditor from "./components/DoorMapEditor.vue"; }, }) export default class extends Vue { - private visible_days = 0; - date = ""; - - public mounted() { - this.$advent22 - .api_get("days/date") - .then((date: string) => (this.date = date)); - - this.$advent22 - .api_get("days/visible_days") - .then((visible_days: number) => (this.visible_days = visible_days)); - } + public is_admin = false; } diff --git a/ui/src/components/AdminButton.vue b/ui/src/components/AdminButton.vue index 629c31e..54608ac 100644 --- a/ui/src/components/AdminButton.vue +++ b/ui/src/components/AdminButton.vue @@ -1,5 +1,5 @@