refactor: replace axios with fetch (#41944)

This commit is contained in:
Oliver Eyton-Williams
2021-06-15 20:47:25 +02:00
committed by GitHub
parent a378bc6dd4
commit 82f3f6ae0c
9 changed files with 72 additions and 36 deletions

View File

@@ -16,7 +16,9 @@ function* fetchSessionUser() {
}
try {
const {
data: { user = {}, result = '', sessionMeta = {} }
user = {},
result = '',
sessionMeta = {}
} = yield call(getSessionUser);
const appUser = user[result] || {};
yield put(
@@ -30,9 +32,11 @@ function* fetchSessionUser() {
function* fetchOtherUser({ payload: maybeUser = '' }) {
try {
const maybeUserLC = maybeUser.toLowerCase();
const { data } = yield call(getUserProfile, maybeUserLC);
const { entities: { user = {} } = {}, result = '' } = data;
const { entities: { user = {} } = {}, result = '' } = yield call(
getUserProfile,
maybeUserLC
);
const otherUser = user[result] || {};
yield put(
fetchProfileForUserComplete({ user: otherUser, username: result })