You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The hook provides a convenient way of doing custom API calls unrelated to transactions or smart contract queries. By default, it will use MultiversX API endpoint. But it can be any type of API, not only MultiversX API. In that case, you would need to pass the `{ baseEndpoint: "https://some-api.com" }` in options
224
+
The hook provides a convenient way of doing custom API calls unrelated to transactions or smart contract queries. By default, it will use MultiversX API endpoint. But it can be any type of API, not only MultiversX API. In that case, you would need to pass the `{ baseEndpoint: "https://some-api.com" }`
url:`/accounts/<some_erd_address_here>/tokens`, // can be any API endpoint without the host, because it is already handled internally
228
+
url:`/accounts/<some_erd_address_here>/tokens`, // can be any API path without the host, because the host is already handled internally
229
229
autoInit:true, // similar to useScQuery
230
230
type:'get', // can be get, post, delete, put
231
231
payload: {},
232
232
options: {}
233
+
baseEndpoint:undefined, // any custom API endpoint, by default MultiversX API
233
234
});
234
235
```
235
236
236
237
You can pass the response type. Returned object is the same as in `useScQuery`
237
238
The hook uses `swr` and native `fetch` under the hood.
238
239
240
+
### ProtectedPageWrapper
241
+
242
+
The component wraps your page contents and will display them only for logged-in users. Otherwise, it will redirect to a defined path. Remember that this is only a client-side check. So don't rely on it with the data that should be private and secured.
<Text>For example the profile page or any other that should be accessible only for logged-in users</Text>
252
+
</ProtectedPageWrapper>
253
+
);
254
+
};
255
+
256
+
exportdefaultProfile;
257
+
```
258
+
239
259
### Working with the API
240
260
241
261
The API endpoint is proxied on the backend side. The only public API endpoint is `/api/multiversx`. This is useful when you don't want to show the API endpoint because, for example, you use the paid ones. Also, there is an option to block the `/api/multiversx` endpoint to be used only within the Dapp, even previewing it in the browser won't be possible.
0 commit comments