page ApiBlockDemo { state nameFilter = "a" state found = "" state failed = "" apis { searchDirectory POST /api/directory { request { body { name?: string } } response { return data.data.users } error { return [] } } } load server serverSearch { const users = await api.searchDirectory({ name: "a" }) return { names: users.map((user) => user.name).join(", ") } } functions { client async function search(): Promise { const users = await api.searchDirectory({ name: nameFilter }) found = users.map((user) => user.name).join(", ") } } view {

{found}

{failed}

Loading…

{serverSearch.names}

Failed: {error.message}

loading

} }