Skip to content

Commit

Permalink
removes delay
Browse files Browse the repository at this point in the history
  • Loading branch information
suryabulusu committed Aug 15, 2023
1 parent 1999468 commit d66e613
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/services/API/RootClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,11 @@ import ErrorHandling from "./ErrorHandling";
const client = axios.create({
baseURL: process.env.VUE_APP_BACKEND,
withCredentials: false,
timeout: 4000, // cancel request after 10 sec
timeout: 4000, // cancel request after 4 sec
// but this works only when internet connection is active
// ref: https://stackoverflow.com/questions/36690451/timeout-feature-in-the-axios-library-is-not-working

Check warning on line 10 in src/services/API/RootClient.ts

View check run for this annotation

Codecov / codecov/patch

src/services/API/RootClient.ts#L8-L10

Added lines #L8 - L10 were not covered by tests
});

// delay response by one second to notice loading spinner
client.interceptors.response.use(function (response) {
return new Promise((resolve) => {
setTimeout(() => {
resolve(response);
}, 1000);
});
}, function (error) {
return Promise.reject(error);
});

// handle errors in responses for API requests
client.interceptors.response.use(
(config: AxiosRequestConfig): AxiosRequestConfig => {
Expand Down

0 comments on commit d66e613

Please sign in to comment.