Skip to content

Commit

Permalink
Replace reqwasm with gloo-net (#2832)
Browse files Browse the repository at this point in the history
* Replace reqwasm with gloo-net

* Use crates.io urls instead of github.com
  • Loading branch information
mike-lloyd03 authored Aug 17, 2022
1 parent 8172b9c commit 72213ee
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 20 deletions.
6 changes: 1 addition & 5 deletions website/community/external-libs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ libraries with Rust and Wasm. Gloo provides ergonomic Rust APIs for working with
- [Dialogs](https://crates.io/crates/gloo-dialogs)
- [Events](https://crates.io/crates/gloo-events)
- [Files](https://crates.io/crates/gloo-file)
- [Requests](https://crates.io/crates/gloo-net)
- [Timers](https://crates.io/crates/gloo-timers)
- [Web Storage](https://crates.io/crates/gloo-storage)

## Reqwasm

[Reqwasm](https://crates.io/crates/reqwasm) is an HTTP requests library for WASM Apps.
It provides idiomatic Rust API for the browser's `fetch` and `WebSocket` API.

## Looking For

Libraries that the ecosystem needs, but doesn't have yet.
Expand Down
4 changes: 2 additions & 2 deletions website/docs/migration-guides/yew/from-0_18_0-to-0_19_0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ html! {
- `TimeoutService`
Use [`gloo-timers`](https://docs.rs/gloo-timers/) instead.
- `WebSocketService`
Use [`wasm-sockets`](https://github.com/scratchyone/wasm-sockets) or [`reqwasm`](https://github.com/hamza1311/reqwasm) instead.
Use [`wasm-sockets`](https://github.com/scratchyone/wasm-sockets) or [`gloo-net`](https://crates.io/crates/gloo-net) instead.
- `FetchService`
Use [`reqwest`](https://crates.io/crates/reqwest) or [`reqwasm`](https://github.com/hamza1311/reqwasm) instead.
Use [`reqwest`](https://crates.io/crates/reqwest) or [`gloo-net`](https://crates.io/crates/gloo-net) instead.

## New crate - yew-agent

Expand Down
6 changes: 3 additions & 3 deletions website/docs/tutorial/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ Struct components act differently. See [the documentation](advanced-topics/struc
In a real world application, data will usually come from an API instead of being hardcoded. Let's fetch our
videos list from external source. For this we will need to add the following crates:

- [`reqwasm`](https://crates.io/crates/reqwasm)
- [`gloo-net`](https://crates.io/crates/gloo-net)
For making the fetch call.
- [`serde`](https://serde.rs) with derive features
For de-serializing the JSON response
Expand All @@ -482,7 +482,7 @@ Let's update the dependencies in `Cargo.toml` file:

```toml title="Cargo.toml"
[dependencies]
reqwasm = "0.2"
gloo-net = "0.2"
serde = { version = "1.0", features = ["derive"] }
wasm-bindgen-futures = "0.4"
```
Expand All @@ -505,7 +505,7 @@ struct Video {
Now as the last step, we need to update our `App` component to make the fetch request instead of using hardcoded data

```rust ,ignore {3-23,32-33}
+ use reqwasm::http::Request;
+ use gloo_net::http::Request;

#[function_component(App)]
fn app() -> Html {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ html! {
- `TimeoutService`
Use [`gloo-timers`](https://docs.rs/gloo-timers/) instead.
- `WebSocketService`
Use [`wasm-sockets`](https://github.com/scratchyone/wasm-sockets) or [`reqwasm`](https://github.com/hamza1311/reqwasm) instead.
Use [`wasm-sockets`](https://github.com/scratchyone/wasm-sockets) or [`gloo-net`](https://crates.io/crates/gloo-net) instead.
- `FetchService`
Use [`reqwest`](https://crates.io/crates/reqwest) or [`reqwasm`](https://github.com/hamza1311/reqwasm) instead.
Use [`reqwest`](https://crates.io/crates/reqwest) or [`gloo-net`](https://crates.io/crates/gloo-net) instead.

## New crate - yew-agent

Expand Down
6 changes: 1 addition & 5 deletions website/versioned_docs/version-0.19.0/more/external-libs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ libraries with Rust and Wasm. Gloo provides ergonomic Rust APIs for working with
- [Dialogs](https://crates.io/crates/gloo-dialogs)
- [Events](https://crates.io/crates/gloo-events)
- [Files](https://crates.io/crates/gloo-file)
- [Requests](https://crates.io/crates/gloo-net)
- [Timers](https://crates.io/crates/gloo-timers)
- [Web Storage](https://crates.io/crates/gloo-storage)

## Reqwasm

[Reqwasm](https://crates.io/crates/reqwasm) is an HTTP requests library for WASM Apps.
It provides idiomatic Rust API for the browser's `fetch` and `WebSocket` API.

## Looking For

Libraries that the ecosystem needs, but doesn't have yet.
Expand Down
6 changes: 3 additions & 3 deletions website/versioned_docs/version-0.19.0/tutorial/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ Struct components act differently. See [the documentation](concepts/components/i
In a real world application, data will usually come from an API instead of being hardcoded. Let's fetch our
videos list from external source. For this we will need to add the following crates:

- [`reqwasm`](https://crates.io/crates/reqwasm)
- [`gloo-net`](https://crates.io/crates/gloo-net)
For making the fetch call.
- [`serde`](https://serde.rs) with derive features
For de-serializing the JSON response
Expand All @@ -475,7 +475,7 @@ Let's update the dependencies in `Cargo.toml` file:

```toml title="Cargo.toml"
[dependencies]
reqwasm = "0.2"
gloo-net = "0.2"
serde = { version = "1.0", features = ["derive"] }
wasm-bindgen-futures = "0.4"
```
Expand All @@ -498,7 +498,7 @@ struct Video {
Now as the last step, we need to update our `App` component to make the fetch request instead of using hardcoded data

```rust ,ignore {3-23,32-33}
+ use reqwasm::http::Request;
+ use gloo_net::http::Request;

#[function_component(App)]
fn app() -> Html {
Expand Down

0 comments on commit 72213ee

Please sign in to comment.