Skip to content

Commit

Permalink
frontend: filebrowser: Add timeout in fetchFolder
Browse files Browse the repository at this point in the history
* Add timeout parameter in fetchFolder since some operations, mainly
  using mavftp may take longer and need custom timeouts
  • Loading branch information
JoaoMario109 committed Oct 1, 2024
1 parent 64aaa8f commit 7907918
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/frontend/src/libs/filebrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ class Filebrowser {
/* Fetch a folder from filebrowser. */
/**
* @param folder_path - String absolute path of folder to be fetched
* @param timeout - Timeout in milliseconds
* @returns FilebrowserFolder object
* */
async fetchFolder(folder_path: string): Promise<FilebrowserFolder> {
async fetchFolder(folder_path: string, timeout = 10000): Promise<FilebrowserFolder> {
return back_axios({
method: 'get',
url: `${filebrowser_url}/resources${folder_path}`,
timeout: 10000,
timeout,
headers: { 'X-Auth': await this.filebrowserToken() },
})
.then((response) => response.data)
Expand Down

0 comments on commit 7907918

Please sign in to comment.