|
|
|
@@ -35,17 +35,28 @@ export function* getRootCategoriesSaga({ payload }) { |
|
|
|
const JwtToken = yield call(authScopeStringGetHelper, JWT_TOKEN); |
|
|
|
yield call(addHeaderToken, JwtToken); |
|
|
|
let result = null; |
|
|
|
if (payload === undefined) { |
|
|
|
if (payload.parentCategoryId === undefined) { |
|
|
|
result = yield call(getRootCategories); |
|
|
|
} else { |
|
|
|
result = yield call(getRootCategories2, payload.parentCategoryId); |
|
|
|
} |
|
|
|
yield put( |
|
|
|
setCategories({ |
|
|
|
categories: result.data.categories, |
|
|
|
childParentRelations: result.data.childParentRelations, |
|
|
|
}) |
|
|
|
); |
|
|
|
|
|
|
|
if (result.data === "") { |
|
|
|
yield call(payload.onNull); |
|
|
|
yield put( |
|
|
|
setCategories({ |
|
|
|
categories: [], |
|
|
|
childParentRelations: [], |
|
|
|
}) |
|
|
|
); |
|
|
|
} else { |
|
|
|
yield put( |
|
|
|
setCategories({ |
|
|
|
categories: result.data.categories, |
|
|
|
childParentRelations: result.data.childParentRelations, |
|
|
|
}) |
|
|
|
); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
const errorMessage = yield call(rejectErrorCodeHelper, error); |
|
|
|
yield put(setCategoriesError(errorMessage)); |