diff --git a/composables/useFetchRequest.js b/composables/useFetchRequest.js index 469702ea5c946bd23a8f8c69dcbd2e67cf111360..7d92c14af2cfce79cd2c7f1830854d90218ded3b 100644 --- a/composables/useFetchRequest.js +++ b/composables/useFetchRequest.js @@ -9,7 +9,7 @@ const useFetchRequest = (baseUrl) => { url = `${baseUrl}${url}` fetchConfig = fetchConfig || {} fetchConfig.headers = fetchConfig.headers || {} - if (window.localStorage) { + if (window && window.localStorage) { fetchConfig.headers.Authorization = localStorage.getItem('token') } fetchConfig.method = (fetchConfig.method || 'get').toLocaleUpperCase() diff --git a/utils/fetchEventSource.js b/utils/fetchEventSource.js index 29d2922a328f6367a3e3873a8208317f913f1df6..423f85ee708554126100d2f670546727ff217df1 100644 --- a/utils/fetchEventSource.js +++ b/utils/fetchEventSource.js @@ -1,7 +1,6 @@ import { fetchEventSource } from '@microsoft/fetch-event-source' const BASE_URL = 'https://gpu-pod656e861afe3d944d6b3ce77e-7862.node.inscode.run' export default (url, { onmessage, onerror, controller, params }) => { - fetchConfig.headers = fetchConfig.headers || {} fetchEventSource(`${BASE_URL}${url}`, { method: 'POST', headers: {