برنامه نویسی
مشکل با هدر axios در nuxt.js

سلام،
من روی پروژه ای با استفاده از nuxt.js کار می کنم که توسعه دهندگان دیگر قبلاً روی آن کار کرده اند.
من چیز زیادی در مورد nuxt.js نمی دانم و مشکلی دارم که نمی توانم آن را حل کنم.
وقتی من یک npm run build
سپس npm run start
برنامه به طور معمول کار می کند، اما زمانی که من یک npm run dev
من خطاهایی دریافت می کنم:
TypeError: Cannot read properties of undefined (reading 'Authorization')
TypeError: Cannot read properties of undefined (reading 'status')
ERROR Cannot read properties of undefined (reading 'status')
at server.js:13024:24
at server.js:455:56
at async asyncData (pages/landing/students.js:2156:35)
at async Promise.all (index 0)
at async Promise.all (index 0)
at async module.exports../.nuxt/server.js.__webpack_exports__.default (server.js:5494:22)
علاوه بر این اگر من حذف headers
از درخواست های axios، دیگر خطایی وجود ندارد و برنامه زمانی که من انجام می دهم کار می کند npm run dev
.
در اینجا بخشی از کد است که باعث ایجاد مشکل شده است:
async asyncData({app, params, $axios, $config: { baseURL } }) {
const res = await $axios.$get(`/api/student`, {
headers: {
'Accept-Language': app.i18n.locale,
},
})
.then((res) => {
console.log(res)
return res
})
.catch((err) => {
console.error(err)
});
return { res }
}