Explorar el Código

Partlu finished feature/685

feature/685
Djordje Mitrovic hace 3 años
padre
commit
af43261050

+ 5
- 2
src/components/Cards/CategoryCard/CategoryCard.js Ver fichero

const [openedDeleteModal, setOpenedDeleteModal] = useState(false); const [openedDeleteModal, setOpenedDeleteModal] = useState(false);
const [openedEditModal, setOpenedEditModal] = useState(false); const [openedEditModal, setOpenedEditModal] = useState(false);
const navigateToCategory = () => { const navigateToCategory = () => {
if (!props.subcategory) {
if (!props.hideCheckButton) {
history.push( history.push(
replaceInRoute(ADMIN_SUBCATEGORIES_PAGE, { replaceInRoute(ADMIN_SUBCATEGORIES_PAGE, {
categoryId: props.category._id, categoryId: props.category._id,
); );
} }
}; };
console.log(props);
return ( return (
<> <>
<CategoryCardContainer className={props.className}> <CategoryCardContainer className={props.className}>
<CategoryCardLeftContainer> <CategoryCardLeftContainer>
<CategoryCardName <CategoryCardName
image={props?.category?.image}
categoryName={props?.category?.name || props?.category?.city} categoryName={props?.category?.name || props?.category?.city}
onClick={navigateToCategory} onClick={navigateToCategory}
/> />
</CategoryCardContainer> </CategoryCardContainer>
{openedDeleteModal && ( {openedDeleteModal && (
<DeleteCategory <DeleteCategory
categoryId={props.categoryId}
setOpenedDeleteModal={setOpenedDeleteModal} setOpenedDeleteModal={setOpenedDeleteModal}
subcategory={props.subcategory} subcategory={props.subcategory}
category={props.category} category={props.category}
hideImagePicker={props.type !== "categories"} hideImagePicker={props.type !== "categories"}
setOpenedEditModal={setOpenedEditModal} setOpenedEditModal={setOpenedEditModal}
category={props.category} category={props.category}
categoryId={props.categoryId}
subcategory={props.subcategory} subcategory={props.subcategory}
type={props.type} type={props.type}
method="edit" method="edit"
className: PropTypes.string, className: PropTypes.string,
subcategory: PropTypes.bool, subcategory: PropTypes.bool,
type: PropTypes.string, type: PropTypes.string,
categoryId: PropTypes.string,
}; };


export default CategoryCard; export default CategoryCard;

+ 15
- 1
src/components/Cards/CategoryCard/CategoryCardName/CategoryCardName.js Ver fichero

import React from "react"; import React from "react";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { import {
CategoryCardImage,
CategoryCardImageContainer,
CategoryCardNameContainer, CategoryCardNameContainer,
CategoryCardNameText, CategoryCardNameText,
CategoryCardNameTextContainer,
} from "./CategoryCardName.styled"; } from "./CategoryCardName.styled";
import { getImageUrl, variants } from "../../../../util/helpers/imageUrlGetter";


const CategoryCardName = (props) => { const CategoryCardName = (props) => {
return ( return (
<CategoryCardNameContainer onClick={props.onClick}> <CategoryCardNameContainer onClick={props.onClick}>
<CategoryCardNameText>{props.categoryName}</CategoryCardNameText>
{props.image && (
<CategoryCardImageContainer>
<CategoryCardImage
src={getImageUrl(props.image, variants.categoryIcon)}
/>
</CategoryCardImageContainer>
)}
<CategoryCardNameTextContainer>
<CategoryCardNameText>{props.categoryName}</CategoryCardNameText>
</CategoryCardNameTextContainer>
</CategoryCardNameContainer> </CategoryCardNameContainer>
); );
}; };
children: PropTypes.node, children: PropTypes.node,
categoryName: PropTypes.string, categoryName: PropTypes.string,
onClick: PropTypes.func, onClick: PropTypes.func,
image: PropTypes.string,
}; };


export default CategoryCardName; export default CategoryCardName;

+ 37
- 3
src/components/Cards/CategoryCard/CategoryCardName/CategoryCardName.styled.js Ver fichero

import selectedTheme from "../../../../themes"; import selectedTheme from "../../../../themes";


export const CategoryCardNameContainer = styled(Box)` export const CategoryCardNameContainer = styled(Box)`
padding: 18px;
min-width: 234px;
width: 234px;
max-width: 234px;
display: flex;
padding-left: 18px;
/* max-width: 300px; */
flex-direction: row;
`; `;
export const CategoryCardNameTextContainer = styled(Box)`
height: 82px;
display: flex;
flex-direction: column;
justify-content: center;
@media (max-width: 600px) {
height: 60px;
}
`
export const CategoryCardNameText = styled(Typography)` export const CategoryCardNameText = styled(Typography)`
font-family: ${selectedTheme.fonts.textFont}; font-family: ${selectedTheme.fonts.textFont};
font-weight: 700; font-weight: 700;
font-size: 16px; font-size: 16px;
line-height: 21px; line-height: 21px;
padding-top: 12px;
max-height: 42px;
overflow: hidden;
text-overflow: ellipsis;
color: ${selectedTheme.colors.primaryPurple}; color: ${selectedTheme.colors.primaryPurple};
cursor: pointer; cursor: pointer;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
@media (max-width: 600px) { @media (max-width: 600px) {
font-size: 18px; font-size: 18px;
padding: 0; padding: 0;
} }
`; `;
export const CategoryCardImageContainer = styled(Box)`
height: 82px;
display: flex;
flex-direction: column;
justify-content: center;
@media (max-width: 600px) {
height: 60px;
}
`
export const CategoryCardImage = styled.img`
width: 18px;
height: 18px;
margin-right: 9px;
position: relative;
top: 1px;
`;

+ 3
- 0
src/components/Cards/CategoryCard/CategoryCheckButton/CategoryCheckButton.styled.js Ver fichero

background-color: ${selectedTheme.colors.primaryPurple} !important; background-color: ${selectedTheme.colors.primaryPurple} !important;
color: white !important; color: white !important;
} }
@media (max-width: 1390px) {
display: none;
}
@media (max-width: 850px) { @media (max-width: 850px) {
display: none; display: none;
} }

+ 5
- 0
src/components/Cards/ItemDetailsCard/Information/Information.styled.js Ver fichero

text-transform: capitalize; text-transform: capitalize;
color: ${selectedTheme.colors.primaryText}; color: ${selectedTheme.colors.primaryText};
font-size: 12px; font-size: 12px;
max-width: 250px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-height: 16px;
@media (max-width: 600px) { @media (max-width: 600px) {
font-size: 12px; font-size: 12px;
} }

+ 8
- 0
src/components/Dropdown/DropdownList/DropdownList.styled.js Ver fichero

padding-bottom: 10px; padding-bottom: 10px;
padding-top: 5px; padding-top: 5px;
padding-right: 0.9rem; padding-right: 0.9rem;
width: 185px;
margin-right: 15px;
max-width: 185px;
overflow: hidden;
white-space: nowrap;
display: inline-block;
text-overflow: ellipsis;
max-height: 26px;
font-family: ${selectedTheme.fonts.textFont}; font-family: ${selectedTheme.fonts.textFont};
color: ${(props) => color: ${(props) =>
props.disabled props.disabled

+ 23
- 0
src/components/Modals/DeleteCategory/DeleteCategory.js Ver fichero

import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useMemo } from "react"; import { useMemo } from "react";
import selectedTheme from "../../../themes"; import selectedTheme from "../../../themes";
import { useDispatch } from "react-redux";
import { fetchAdminMethod } from "../../../store/actions/admin/adminActions";
import { DELETE_TYPE } from "../../../constants/adminMethodConstants";


const DeleteCategory = (props) => { const DeleteCategory = (props) => {
const dispatch = useDispatch();
const { t } = useTranslation(); const { t } = useTranslation();
console.log(props.category); console.log(props.category);
const handleCancel = () => { const handleCancel = () => {
const reassuranceText = useMemo(() => { const reassuranceText = useMemo(() => {
return t(`admin.${props.type}.reassuranceDelete`); return t(`admin.${props.type}.reassuranceDelete`);
}, [props, t]); }, [props, t]);

const handleApiResponseSuccess = () => {
handleCancel();
};

const handleSubmit = () => {
dispatch(
fetchAdminMethod({
type: props.type,
method: DELETE_TYPE,
name: props.category?.name,
id: props.category?._id,
categoryId: props.categoryId,
handleApiResponseSuccess,
})
);
};
return ( return (
<> <>
<BackdropComponent <BackdropComponent
<SaveButton <SaveButton
variant="outlined" variant="outlined"
buttoncolor={selectedTheme.colors.primaryPurple} buttoncolor={selectedTheme.colors.primaryPurple}
onClick={handleSubmit}
> >
{t(`admin.${props.type}.delete`)} {t(`admin.${props.type}.delete`)}
</SaveButton> </SaveButton>
customLabeledCardWidth: PropTypes.string, customLabeledCardWidth: PropTypes.string,
customLabeledCardHeight: PropTypes.string, customLabeledCardHeight: PropTypes.string,
customLabeledCardIcon: PropTypes.node, customLabeledCardIcon: PropTypes.node,
categoryId: PropTypes.string,
}; };


export default DeleteCategory; export default DeleteCategory;

+ 33
- 7
src/components/Modals/EditCategory/EditCategory.js Ver fichero

import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
import { useFormik } from "formik"; import { useFormik } from "formik";
import { useMemo } from "react"; import { useMemo } from "react";
import { useDispatch } from "react-redux";
import { fetchAdminMethod } from "../../../store/actions/admin/adminActions";
import { useRef } from "react";


const EditCategory = (props) => { const EditCategory = (props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [image, setImage] = useState("");
console.log(props);
const dispatch = useDispatch();
const [clickedOnNext, setClickedOnNext] = useState(false);
const setImage = useState("")[1];
const inputRef = useRef(null);
const title = useMemo(() => { const title = useMemo(() => {
return t(`admin.${props.type}.${props.method}.title`); return t(`admin.${props.type}.${props.method}.title`);
}, [props.type, props.method]); }, [props.type, props.method]);
setImage(image); setImage(image);
formik.setFieldValue("image", image); formik.setFieldValue("image", image);
}; };
const handleApiResponseSuccess = () => {
if (clickedOnNext) {
formik.resetForm();
inputRef.current.focus();
} else props.setOpenedEditModal(false);
};
const handleSubmit = (values) => { const handleSubmit = (values) => {
console.log(values);
console.log(image);
dispatch(
fetchAdminMethod({
type: props.type,
method: props.method,
values,
name: props?.category?.name,
id: props?.category?._id,
categoryId: props.categoryId,
handleApiResponseSuccess,
})
);
}; };
const formik = useFormik({ const formik = useFormik({
initialValues: { initialValues: {
image: "", image: "",
title: props?.category?.name || props?.category?.city || "",
title: props?.category?.name || props?.category?.city || "",
}, },
onSubmit: handleSubmit, onSubmit: handleSubmit,
}); });
const handleClick = (next) => {
if (next !== clickedOnNext) setClickedOnNext(next);
formik.handleSubmit();
};
console.log(props); console.log(props);
return ( return (
<> <>
<FieldLabel leftText={fieldLabel} /> <FieldLabel leftText={fieldLabel} />
<CategoryTitleField <CategoryTitleField
name="title" name="title"
ref={inputRef}
placeholder={placeholder} placeholder={placeholder}
italicPlaceholder italicPlaceholder
margin="normal" margin="normal"
showSecondButton={props.showSecondButton} showSecondButton={props.showSecondButton}
variant={props.firstOutlined ? "outlined" : "contained"} variant={props.firstOutlined ? "outlined" : "contained"}
height="48px" height="48px"
onClick={formik.handleSubmit}
onClick={() => handleClick(true)}
> >
{firstButtonText} {firstButtonText}
</SaveButton> </SaveButton>
<SaveButton <SaveButton
variant={props.secondOutlined ? "outlined" : "contained"} variant={props.secondOutlined ? "outlined" : "contained"}
showSecondButton={props.showSecondButton} showSecondButton={props.showSecondButton}
onClick={formik.handleSubmit}
onClick={() => handleClick(false)}
> >
{secondButtonText} {secondButtonText}
</SaveButton> </SaveButton>
method: PropTypes.string, method: PropTypes.string,
firstOutlined: PropTypes.bool, firstOutlined: PropTypes.bool,
secondOutlined: PropTypes.bool, secondOutlined: PropTypes.bool,
categoryId: PropTypes.string,
}; };


EditCategory.defaultProps = { EditCategory.defaultProps = {

+ 3
- 0
src/constants/adminMethodConstants.js Ver fichero

export const EDIT_TYPE = "edit";
export const DELETE_TYPE = "delete";
export const ADD_TYPE = "add";

+ 5
- 0
src/constants/adminTypeConstants.js Ver fichero

export const CATEGORIES_TYPE = "categories";
export const SUBCATEGORIES_TYPE = "subcategories";
export const USERS_TYPE = "users";
export const LOCATIONS_TYPE = "locations";
export const REVIEW_TYPE = "reviews";

+ 1
- 1
src/i18n/resources/rs.js Ver fichero

fieldTitle: "Naslov", fieldTitle: "Naslov",
placeholder: "Naziv podkategorije...", placeholder: "Naziv podkategorije...",
save: "Izmeni", save: "Izmeni",
next: "Sledeća",
next: "Izmeni",
}, },
add: { add: {
title: "Nova Podkategorija", title: "Nova Podkategorija",

+ 1
- 0
src/pages/AdminHomePage/AdminLocationsPage/AdminLocationsPage.js Ver fichero

<LocationsList> <LocationsList>
{locationsToShow.map((category) => ( {locationsToShow.map((category) => (
<CategoryCard <CategoryCard
dontNavigate
key={category._id} key={category._id}
category={category} category={category}
type="locations" type="locations"

+ 6
- 4
src/pages/AdminHomePage/AdminSubcategoriesPage/AdminSubcategoriesPage.js Ver fichero

return []; return [];
}, [category, manualSearchString]); }, [category, manualSearchString]);
console.log("subc", categories); console.log("subc", categories);
return ( return (
<> <>
<AdminSubcategoriesPageContainer> <AdminSubcategoriesPageContainer>
hideBackButton hideBackButton
/> />
<SubcategoriesList> <SubcategoriesList>
{subcategories.map((category) => (
{subcategories.map((subcategory) => (
<CategoryCard <CategoryCard
categoryId={category._id}
subcategory subcategory
key={category._id}
category={category}
key={subcategory._id}
category={subcategory}
type="subcategories" type="subcategories"
hideSecondLabel hideSecondLabel
hideCheckButton hideCheckButton
{openedAddModal && ( {openedAddModal && (
<EditCategory <EditCategory
hideImagePicker hideImagePicker
categoryId={category._id}
setOpenedEditModal={setOpenedAddModal} setOpenedEditModal={setOpenedAddModal}
type="subcategories" type="subcategories"
method="add" method="add"

+ 19
- 2
src/request/apiEndpoints.js Ver fichero

editProfile: "users", editProfile: "users",
editProfileAsAdmin: "admin/users/{userId}", editProfileAsAdmin: "admin/users/{userId}",
getAllProfiles: "users", getAllProfiles: "users",
getAllProfilesAsAdmin: "admin/users"
getAllProfilesAsAdmin: "admin/users",
}, },
applications: { applications: {
application: "/applications/{applicationUid}", application: "/applications/{applicationUid}",
}, },
exchange: { exchange: {
getExchange: "exchanges", getExchange: "exchanges",
validateExchange: "exchanges"
validateExchange: "exchanges",
}, },
reviews: { reviews: {
postReview: "reviews", postReview: "reviews",
}, },
admin: {
categories: {
newCategory: "admin/categories",
editCategory: "admin/categories/{categoryId}",
deleteCategory: "admin/categories/{categoryId}",
},
subcategories: {
newSubcategory: "admin/categories/{categoryId}",
editSubcategory: "admin/categories/{categoryId}/{subcategoryName}",
deleteSubcategory: "admin/categories/{categoryId}/{subcategoryName}",
},
locations: {
newLocation: "admin/locations",
editLocation: "admin/locations/{locationId}",
deleteLocation: "admin/locations/{locationId}"
}
},
}; };

+ 48
- 1
src/request/categoriesRequest.js Ver fichero

import { getRequest } from ".";
import {
deleteRequest,
getRequest,
postRequest,
putRequest,
replaceInUrl,
} from ".";
import apiEndpoints from "./apiEndpoints"; import apiEndpoints from "./apiEndpoints";


export const attemptFetchCategories = () => export const attemptFetchCategories = () =>
getRequest(apiEndpoints.offers.categories); getRequest(apiEndpoints.offers.categories);

export const attemptAddNewCategory = (payload) =>
postRequest(apiEndpoints.admin.categories.newCategory, payload.body);

export const attemptEditCategory = (payload) =>
putRequest(
replaceInUrl(apiEndpoints.admin.categories.editCategory, {
categoryId: payload.categoryId,
}),
payload.body
);
export const attemptDeleteCategory = (payload) =>
deleteRequest(
replaceInUrl(apiEndpoints.admin.categories.deleteCategory, {
categoryId: payload.categoryId,
})
);

export const attemptAddNewSubcategory = (payload) =>
postRequest(
replaceInUrl(apiEndpoints.admin.subcategories.newSubcategory, {
categoryId: payload.categoryId,
}),
payload.body
);
export const attemptEditSubcategory = (payload) =>
putRequest(
replaceInUrl(apiEndpoints.admin.subcategories.editSubcategory, {
categoryId: payload.categoryId,
subcategoryName: payload.subcategoryName,
}),
payload.body
);
export const attemptDeleteSubcategory = (payload) =>
deleteRequest(
replaceInUrl(apiEndpoints.admin.subcategories.deleteSubcategory, {
categoryId: payload.categoryId,
subcategoryName: payload.subcategoryName,
})
);

+ 25
- 2
src/request/locationsRequest.js Ver fichero

import { getRequest } from ".";
import {
deleteRequest,
getRequest,
postRequest,
putRequest,
replaceInUrl,
} from ".";
import apiEndpoints from "./apiEndpoints"; import apiEndpoints from "./apiEndpoints";


export const attemptFetchLocations = () => export const attemptFetchLocations = () =>
getRequest(apiEndpoints.offers.locations);
getRequest(apiEndpoints.offers.locations);
export const attemptAddNewLocation = (payload) =>
postRequest(apiEndpoints.admin.locations.newLocation, payload.body);

export const attemptEditLocation = (payload) =>
putRequest(
replaceInUrl(apiEndpoints.admin.locations.editLocation, {
locationId: payload.locationId,
}),
payload.body
);

export const attemptDeleteLocation = (payload) =>
deleteRequest(
replaceInUrl(apiEndpoints.admin.locations.deleteLocation, {
locationId: payload.locationId,
})
);

+ 10
- 0
src/store/actions/admin/adminActionConstants.js Ver fichero

import {
createErrorType,
createFetchType,
createSuccessType,
} from "../actionHelpers";

const ADMIN_SCOPE = "ADMIN";
export const ADMIN_FETCH = createFetchType(ADMIN_SCOPE);
export const ADMIN_FETCH_SUCCESS = createSuccessType(ADMIN_SCOPE);
export const ADMIN_FETCH_ERROR = createErrorType(ADMIN_SCOPE);

+ 16
- 0
src/store/actions/admin/adminActions.js Ver fichero

import {
ADMIN_FETCH,
ADMIN_FETCH_ERROR,
ADMIN_FETCH_SUCCESS,
} from "./adminActionConstants";

export const fetchAdminMethod = (payload) => ({
type: ADMIN_FETCH,
payload,
});
export const fetchAdminMethodSuccess = () => ({
type: ADMIN_FETCH_SUCCESS,
});
export const fetchAdminMethodError = () => ({
type: ADMIN_FETCH_ERROR,
});

+ 194
- 0
src/store/saga/adminSaga.js Ver fichero

import { all, call, put, takeLatest } from "@redux-saga/core/effects";
import {
ADD_TYPE,
DELETE_TYPE,
EDIT_TYPE,
} from "../../constants/adminMethodConstants";
import {
CATEGORIES_TYPE,
LOCATIONS_TYPE,
SUBCATEGORIES_TYPE,
} from "../../constants/adminTypeConstants";
import {
attemptAddNewCategory,
attemptAddNewSubcategory,
attemptDeleteCategory,
attemptDeleteSubcategory,
attemptEditCategory,
attemptEditSubcategory,
} from "../../request/categoriesRequest";
import {
attemptAddNewLocation,
attemptDeleteLocation,
attemptEditLocation,
} from "../../request/locationsRequest";
// import { attemptAddNewCategory } from "../../request/categoriesRequest";
import { ADMIN_FETCH } from "../actions/admin/adminActionConstants";
import {
fetchAdminMethodError,
fetchAdminMethodSuccess,
} from "../actions/admin/adminActions";
import { fetchCategories } from "../actions/categories/categoriesActions";
import { fetchLocations } from "../actions/locations/locationsActions";

function* editCategory(payload) {
try {
yield call(attemptEditCategory, {
categoryId: payload.id,
body: { name: payload.values.title },
});
yield put(fetchCategories());
} catch (e) {
yield call(console.log, e);
}
}
function* addCategory(payload) {
try {
let dataToSend = new FormData();
dataToSend.append("name", payload.values.title);
dataToSend.append("file", payload.values.image);
dataToSend.append("subcategories", JSON.stringify([]));
yield call(attemptAddNewCategory, {
body: dataToSend,
});
yield put(fetchCategories());
} catch (e) {
yield call(console.log, e);
}
}

function* deleteCategory(payload) {
try {
yield call(attemptDeleteCategory, {
categoryId: payload.id,
});
yield put(fetchCategories());
} catch (e) {
yield call(console.log, e);
}
}

function* editSubcategory(payload) {
try {
yield call(attemptEditSubcategory, {
categoryId: payload.id,
subcategoryName: payload.name,
body: { name: payload.values.title },
});
yield put(fetchCategories());
} catch (e) {
yield call(console.log, e);
}
}
function* addSubcategory(payload) {
try {
yield call(attemptAddNewSubcategory, {
categoryId: payload.id,
body: { name: payload.values.title },
});
yield put(fetchCategories());
} catch (e) {
yield call(console.log, e);
}
}

function* deleteSubcategory(payload) {
try {
yield call(attemptDeleteSubcategory, {
categoryId: payload.id,
subcategoryName: payload.name,
});
yield put(fetchCategories());
} catch (e) {
yield call(console.log, e);
}
}

function* editLocation(payload) {
try {
yield call(attemptEditLocation, {
locationId: payload.id,
body: { city: payload.values.title },
});
yield put(fetchLocations());
} catch (e) {
yield call(console.log, e);
}
}
function* addLocation(payload) {
try {
yield call(attemptAddNewLocation, {
locationId: payload.id,
body: { city: payload.values.title },
});
yield put(fetchLocations());
} catch (e) {
yield call(console.log, e);
}
}

function* deleteLocation(payload) {
try {
yield call(attemptDeleteLocation, {
locationId: payload.id,
});
yield put(fetchLocations());
} catch (e) {
yield call(console.log, e);
}
}

function* fetchAdminMethod({ payload }) {
try {
yield call(console.log, "admin", payload);
if (payload.type === CATEGORIES_TYPE) {
if (payload.method === ADD_TYPE)
yield call(addCategory, { values: payload.values, id: payload.id });
else if (payload.method === EDIT_TYPE)
yield call(editCategory, { values: payload.values, id: payload.id });
else if (payload.method === DELETE_TYPE)
yield call(deleteCategory, { id: payload.id });
} else if (payload.type === SUBCATEGORIES_TYPE) {
if (payload.method === EDIT_TYPE)
yield call(editSubcategory, {
values: payload.values,
id: payload.categoryId,
name: payload.name,
});
else if (payload.method === DELETE_TYPE)
yield call(deleteSubcategory, {
id: payload.categoryId,
name: payload.name,
});
else if (payload.method === ADD_TYPE)
yield call(addSubcategory, {
values: payload.values,
id: payload.categoryId,
});
} else if (payload.type === LOCATIONS_TYPE) {
if (payload.method === ADD_TYPE)
yield call(addLocation, {
values: payload.values,
id: payload.id,
});
else if (payload.method === EDIT_TYPE)
yield call(editLocation, {
values: payload.values,
id: payload.id,
});
else if (payload.method === DELETE_TYPE)
yield call(deleteLocation, {
id: payload.id,
});
}
if (payload.handleApiResponseSuccess)
yield call(payload.handleApiResponseSuccess);
yield put(fetchAdminMethodSuccess());
} catch (e) {
yield put(fetchAdminMethodError());
}
}

export default function* adminSaga() {
yield all([takeLatest(ADMIN_FETCH, fetchAdminMethod)]);
}

+ 3
- 1
src/store/saga/index.js Ver fichero

import { all } from 'redux-saga/effects'; import { all } from 'redux-saga/effects';
import adminSaga from './adminSaga';
import categoriesSaga from './categoriesSaga'; import categoriesSaga from './categoriesSaga';
import chatSaga from './chatSaga'; import chatSaga from './chatSaga';
import counterSaga from './counterSaga'; import counterSaga from './counterSaga';
queryStringSaga(), queryStringSaga(),
exchangeSaga(), exchangeSaga(),
reviewSaga(), reviewSaga(),
counterSaga()
counterSaga(),
adminSaga()
]); ]);
} }

+ 3
- 1
src/util/helpers/imageUrlGetter.js Ver fichero

profileCard: "profileCard", profileCard: "profileCard",
createReviewCard: "createReviewCard", createReviewCard: "createReviewCard",
carousel: "carousel", carousel: "carousel",
adminProfileCard: "reviewCard"
adminProfileCard: "reviewCard",
categoryIcon: "categoryIcon"
}; };


const cloudFlareVariants = { const cloudFlareVariants = {
createReviewCard: "primaryMobile", createReviewCard: "primaryMobile",
carousel: "carousel", carousel: "carousel",
carouselMobile: "carouselMobile", carouselMobile: "carouselMobile",
categoryIcon: "categoryIcon"
}; };
export const getImageUrl = (imageUrl, variant, isMobile = false) => { export const getImageUrl = (imageUrl, variant, isMobile = false) => {
let imageVariant = ""; let imageVariant = "";

+ 2
- 1
src/util/helpers/routeHelpers.js Ver fichero

dynamicRouteMatches(ADMIN_SUBCATEGORIES_PAGE) || dynamicRouteMatches(ADMIN_SUBCATEGORIES_PAGE) ||
routeMatches(ADMIN_LOCATIONS_PAGE) || routeMatches(ADMIN_LOCATIONS_PAGE) ||
routeMatches(ADMIN_PAYMENT_PAGE) || routeMatches(ADMIN_PAYMENT_PAGE) ||
dynamicRouteMatches(ADMIN_SINGLE_USER_PAGE)
dynamicRouteMatches(ADMIN_SINGLE_USER_PAGE) ||
isInRoute(ADMIN_HOME_PAGE)
) )
return true; return true;
return false; return false;

Cargando…
Cancelar
Guardar