Skip to content

Commit

Permalink
Skip view_api request in js client when auth enabled (#5412)
Browse files Browse the repository at this point in the history
* Add code

* add changeset

* Remove console

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
freddyaboulton and gradio-pr-bot committed Sep 6, 2023
1 parent bb31cd7 commit 26fef8c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/silent-otters-brake.md
@@ -0,0 +1,6 @@
---
"@gradio/client": patch
"gradio": patch
---

fix:Skip view_api request in js client when auth enabled
6 changes: 6 additions & 0 deletions client/js/src/client.ts
Expand Up @@ -269,6 +269,12 @@ export function api_factory(fetch_implementation: typeof fetch): Client {
async function config_success(_config: Config): Promise<client_return> {
config = _config;
api_map = map_names_to_ids(_config?.dependencies || []);
if (config.auth_required) {
return {
config,
...return_obj
};
}
try {
api = await view_api(config);
} catch (e) {
Expand Down

0 comments on commit 26fef8c

Please sign in to comment.