mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
Add safe mode to joke api (#3429)
* Add safe mode to joke api * cargo fmt
This commit is contained in:
parent
443dba3cf8
commit
28e673a426
@ -28,13 +28,14 @@ pub fn emit_jokes(joke_cb: Callback<AttrValue>) {
|
||||
spawn_local(async move {
|
||||
loop {
|
||||
// Fetch the online joke
|
||||
let fun_fact = Request::get("https://v2.jokeapi.dev/joke/Programming?format=txt")
|
||||
.send()
|
||||
.await
|
||||
.unwrap()
|
||||
.text()
|
||||
.await
|
||||
.unwrap();
|
||||
let fun_fact =
|
||||
Request::get("https://v2.jokeapi.dev/joke/Programming?format=txt&safe-mode")
|
||||
.send()
|
||||
.await
|
||||
.unwrap()
|
||||
.text()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// Emit it to the component
|
||||
joke_cb.emit(AttrValue::from(fun_fact));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user