tablo-core 0.1.0

The core toolkit types for Tablo, a server-rendered admin toolkit on Topcoat and Toasty.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! The handler behind every registered [`Page`].

use topcoat::{context::Cx, router::Body, view::BoxView};

use crate::{Page, topcoat_compat::async_page};

/// `GET` for a registered page: the auth re-check every panel handler runs,
/// then the page's own body.
pub(super) fn page_handler<P: Page>(cx: &Cx, _body: Body) -> BoxView<'_> {
    async_page(async move {
        crate::auth::guard(cx)?;
        P::render(cx).await
    })
}

#[cfg(test)]
mod tests;