Skip to content

Commit

Permalink
Closed #169 changed default timeout from 5s -> 15s and read_data time…
Browse files Browse the repository at this point in the history
…out from 5s -> 2m. Changed the default timeout error message (#175)
  • Loading branch information
jandsonrj committed Aug 2, 2023
1 parent 422d85f commit 86c67a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion frontend/services/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { refreshToken } from './auth'
export function getAPIClient(ctx) {
const api = axios.create({
// baseURL: '/api',
timeout: 5000,
timeout: 15000,
headers: {
'Content-Type': 'application/json',
accept: 'application/json'
Expand Down Expand Up @@ -84,6 +84,9 @@ export function getAPIClient(ctx) {
// return Promise.reject(error.response.data)
// }
}
if (error.code === 'ECONNABORTED' && error.message.includes('timeout')) {
error.message = 'The connection has timed out.'
}
return Promise.reject(error)
}
)
Expand Down
2 changes: 1 addition & 1 deletion frontend/services/product.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const fetchProductData = ({ queryKey }) => {
return
}
page += 1
return api.get(`/api/products/${productId}/read_data/`, { params: { page, page_size } }).then(res => res.data)
return api.get(`/api/products/${productId}/read_data/`, { timeout: 120000, params: { page, page_size } }).then(res => res.data)
}

export const deleteProduct = product_id => {
Expand Down

0 comments on commit 86c67a5

Please sign in to comment.