Код: Выделить всё
export const poster = async ({url, method = 'POST', body}: PosterType) => {
const {cookie} = store.getState().userReducer;
// Only add Authorization header if cookie exists
return await axios({
url,
method: method,
headers: {
Authorization: `Bearer ${cookie}`,
'Content-Type': 'application/json',
Accept: 'application/json',
},
data: body,
withCredentials: false,
// mode: 'cors',
})
.then(async value => {
const data = await value.data;
if (!value.status) {
throw new Error(data.message ?? data?.error?.message);
}
return data;
})
.catch(error => {
// console.log(JSON.stringify(error), 'errorerrorerrorerror');
throw error;
});
};
Как я могу исправить эту проблему на Android, чтобы гарантировать, что токен авторизации передается правильно и аутентифицируется сервером, как это происходит на iOS?
Подробнее здесь: https://stackoverflow.com/questions/790 ... ine-on-ios