remove old references to server context

This commit is contained in:
Evan Almloff committed 2023-07-07 18:39:18 -07:00
1 parent fb042df2fb
commit 41f9c480c8
5 files changed
+16 -21

No files matched your search

+2 -7
View File
@@ -69,12 +69,11 @@ fn app(cx: Scope<AppProps>) -> Element {
class: "server-button",
onclick: move |_| {
to_owned![text];
let sc = cx.sc();
async move {
if let Ok(data) = get_server_data().await {
println!("Client received: {}", data);
text.set(data.clone());
post_server_data(sc, data).await.unwrap();
post_server_data(data).await.unwrap();
}
}
},
@@ -85,12 +84,8 @@ fn app(cx: Scope<AppProps>) -> Element {
}
#[server(PostServerData)]
async fn post_server_data(cx: DioxusServerContext, data: String) -> Result<(), ServerFnError> {
// The server context contains information about the current request and allows you to modify the response.
cx.response_headers_mut()
.insert("Set-Cookie", "foo=bar".parse().unwrap());
async fn post_server_data(data: String) -> Result<(), ServerFnError> {
println!("Server received: {}", data);
println!("Request parts are {:?}", cx.request_parts());
Ok(())
}