TP
Size: a a a
TP
KZ
KZ
TP
es
꧁岡
es
K
const getLocation = ({user}) => user.locationId;
const getToken = ({auth}) => auth.token;
export function* configInterseptors() {
const locationId = yield select(getLocation);
const token = yield select(getToken);
axiosAPI.interceptors.request.use(
async (req) => {
req.headers = {
Authorization: `Bearer ${token}`,
'X-Merchant-Location': `${!!locationId ? locationId : ''}`
};
return req;
},
(error) => {
Promise.reject(error);
}
);
}
export default function* rootSaga() {
yield fork(configInterseptors);
yield all([yield takeEvery(getUserData, getUserDataSaga)]); //Gets token
yield all([yield takeEvery(getLocationData, getUsersLocationsSaga)]); //Gets location ID
}
es
TP
es
YP
t
0
ТК
ТК
AD