Skip to content

How to pull an api endpoint without parameters? #335

Answered by gbj
MTRNord asked this question in Q&A
Discussion options

You must be logged in to vote

This is surprising: something like a simple || () should work as the trigger if it never needs to change.

Without access to your API, I'm not sure what's going on. I ran a simple test like this, where I just return Some(true) from the resource, and it seems to work fine.

#[component]
pub fn HomePage(cx: Scope) -> impl IntoView {
    let graph = create_resource(cx, || (), move |_| async move { Some(true) });

    view! { cx,
        <main class="my-0 mx-auto max-w-3xl text-center">
            <h1 class="p-6 text-4xl">"Welcome to the Knowledge!"</h1>
            <Suspense fallback=|| view! { cx, "Loading..." }>
                    {move || graph.read().map(|graph| match graph {

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@MTRNord
Comment options

@MTRNord
Comment options

Answer selected by MTRNord
Comment options

You must be logged in to vote
2 replies
@floric
Comment options

@gbj
Comment options

gbj Jan 22, 2023
Maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants