From d80208b5d219d24a0109011959463ad4d270d946 Mon Sep 17 00:00:00 2001 From: Rebecca Drabenstott Date: Tue, 11 Jun 2024 18:24:42 -0400 Subject: [PATCH] Make extended timeout specific to /batch/{pk}/ GET requests (#479) * Make extended timeout specific to /batch/{pk}/ GET requests And set default timeout back to previous value * Relocate extended timeout to api.js --------- Co-authored-by: Rebecca Drabenstott --- src/service/api.js | 2 +- src/service/axios.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/service/api.js b/src/service/api.js index 314e62bd..64c92185 100644 --- a/src/service/api.js +++ b/src/service/api.js @@ -108,7 +108,7 @@ export const api = createApi({ }, }), getBatch: builder.query({ - query: ({ id }) => ({ url: `batch/${id}/`, method: 'get' }), + query: ({ id }) => ({ url: `batch/${id}/`, method: 'get', timeout: 30 * 1000 }), providesTags: (result, _err, { id }) => { const tags = [{ type: 'Batch', id }]; // TODO: Add petitions from this result to redux store diff --git a/src/service/axios.js b/src/service/axios.js index c2044c45..81ee4e64 100644 --- a/src/service/axios.js +++ b/src/service/axios.js @@ -4,7 +4,7 @@ import { CSRF_COOKIE_NAME, CSRF_HEADER_KEY } from '../constants/authConstants'; const Axios = axios.create({ baseURL: `/petition/api/`, - timeout: 20 * 1000, + timeout: 5 * 1000, withCredentials: true, // allow setting/passing cookies xsrfCookieName: CSRF_COOKIE_NAME, xsrfHeaderName: CSRF_HEADER_KEY,