Parcourir la source

App now works

bugfix/app-changes
Djordje Mitrovic il y a 3 ans
Parent
révision
a2fec5ba83
32 fichiers modifiés avec 164 ajouts et 59 suppressions
  1. 2
    1
      src/components/Cards/FilterCard/Choser/SubcategoryChoser/SubcategoryChoser.js
  2. 1
    1
      src/components/Cards/FilterCard/FilterDropdown/Radio/FilterRadioDropdown.js
  3. 19
    0
      src/components/Cards/LittleOfferCard/LittleOfferCard.styled.js
  4. 5
    1
      src/components/Cards/MessageCard/MessageCard.styled.js
  5. 2
    2
      src/components/Cards/OfferCard/DeleteOffer/DeleteOffer.js
  6. 1
    1
      src/components/Cards/OfferCard/DeleteOffer/DeleteOffer.styled.js
  7. 2
    2
      src/components/Cards/OfferCard/DeleteOffer/DeleteOfferLabeledCard/DeleteOfferLabeledCard.js
  8. 5
    1
      src/components/Cards/OfferCard/DeleteOffer/DeleteOfferLabeledCard/DeleteOfferLabeledCard.styled.js
  9. 2
    1
      src/components/Cards/OfferCard/DeleteOffer/OfferDescription/OfferDescription.js
  10. 2
    0
      src/components/Cards/RequestExchangeCard/RequestExchangeCard.styled.js
  11. 3
    1
      src/components/Cards/UserReviewsCard/UserReviewsSingleCard/ReviewQuote/ReviewQuote.styled.js
  12. 15
    7
      src/components/CreateReview/CreateReview.styled.js
  13. 2
    1
      src/components/CreateReview/FirstStep/FirstStepCreateReview.js
  14. 5
    3
      src/components/CreateReview/FirstStep/FirstStepCreateReview.styled.js
  15. 13
    13
      src/components/CreateReview/SecondStep/SecondStepCreateReview.js
  16. 13
    1
      src/components/CreateReview/SecondStep/SecondStepCreateReview.styled.js
  17. 2
    1
      src/components/DirectChat/DirectChat.js
  18. 1
    1
      src/components/DirectChat/DirectChatContent/DirectChatContent.styled.js
  19. 5
    1
      src/components/DirectChat/DirectChatContent/DirectChatContentHeader/DirectChatContentHeader.js
  20. 7
    0
      src/components/DirectChat/DirectChatContent/DirectChatContentHeader/DirectChatContentHeader.styled.js
  21. 7
    1
      src/components/Header/Drawer/Buttons/MyProfileButton/MyProfileButton.js
  22. 8
    2
      src/components/ItemDetails/ItemDetailsHeaderCard/ItemDetailsHeaderCard.js
  23. 6
    1
      src/components/Popovers/MyMessages/MyMessages.js
  24. 7
    2
      src/components/UserReviews/UserReviews.js
  25. 3
    1
      src/components/UserReviews/UserReviews.styled.js
  26. 1
    0
      src/constants/chatConstants.js
  27. 2
    0
      src/i18n/resources/rs.js
  28. 5
    5
      src/pages/AdminHomePage/AdminLocationsPage/AdminLocationsPage.styled.js
  29. 2
    2
      src/request/index.js
  30. 2
    2
      src/store/middleware/accessTokensMiddleware.js
  31. 8
    2
      src/util/helpers/chatHelper.js
  32. 6
    2
      src/util/helpers/messageHelper.js

+ 2
- 1
src/components/Cards/FilterCard/Choser/SubcategoryChoser/SubcategoryChoser.js Voir le fichier

@@ -42,7 +42,8 @@ const SubcategoryChoser = forwardRef((props, ref) => {
if (
(filters.category.selectedCategoryLocally &&
!("_id" in filters.category.selectedCategoryLocally)) ||
filters.category.selectedCategoryLocally?._id === 0
filters.category.selectedCategoryLocally?._id === 0 ||
!filters.category.selectedCategoryLocally
) {
setIsOpened(false);
setIsDisabled(true);

+ 1
- 1
src/components/Cards/FilterCard/FilterDropdown/Radio/FilterRadioDropdown.js Voir le fichier

@@ -113,7 +113,7 @@ const FilterRadioDropdown = (props) => {
fullWidth
checked={
(props?.selected && !("_id" in props?.selected)) ||
props?.selected?._id === 0
props?.selected?._id === 0 || !props?.selected
}
onChange={props.setSelected}
/>

+ 19
- 0
src/components/Cards/LittleOfferCard/LittleOfferCard.styled.js Voir le fichier

@@ -17,6 +17,9 @@ export const LittleOfferCardContainer = styled(Box)`
display: flex;
flex-direction: row;
position: relative;
@media (max-width: 600px) {
width: 211px;
}
`
export const OfferImage = styled.img`
width: 54px;
@@ -28,6 +31,7 @@ export const OfferImage = styled.img`
`
export const OfferDetails = styled(Box)`
display: flex;
text-align: left;
flex-direction: column;
margin-top: 25px;
margin-left: 9px;
@@ -50,6 +54,9 @@ export const OfferCategoryIcon = styled(Category)`
position: relative;
top: 1.5px;
right: 2px;
& path {
stroke-width: 1;
}
`
export const OfferSwapsIconContainer = styled(Icon)`
width: 40px;
@@ -63,10 +70,22 @@ export const OfferSwapsIconContainer = styled(Icon)`
width: 40px;
height: 40px;
}
@media (max-width: 600px) {
width: 32px;
height: 32px;
top: -15px;
right: -15px;
}
`
export const OfferSwapsIcon = styled(Swaps)`
width: 18px;
height: 18px;
position: relative;
top: 10px;
@media (max-width: 600px) {
width: 14px;
height: 14px;
top: 2px;
left: -4px;
}
`

+ 5
- 1
src/components/Cards/MessageCard/MessageCard.styled.js Voir le fichier

@@ -14,7 +14,9 @@ export const ProfileImage = styled.img`
overflow: hidden;
border-radius: 100%;
@media (max-width: 600px) {
display: none;
width: 18px;
height: 18px;
min-width: 18px;
}
`;
export const MessageContent = styled(Box)`
@@ -29,6 +31,8 @@ export const MessageContent = styled(Box)`
min-width: 110px;
@media (max-width: 600px) {
width: 100%;
margin: 0;
${props => props.ismymessage ? "margin-right: 9px;" : "margin-left: 9px;"}
}
`;
export const MessageText = styled(Typography)`

+ 2
- 2
src/components/Cards/OfferCard/DeleteOffer/DeleteOffer.js Voir le fichier

@@ -26,7 +26,6 @@ import { useHistory } from "react-router-dom";
import useIsMobile from "../../../../hooks/useIsMobile";
import { getImageUrl, variants } from "../../../../util/helpers/imageUrlGetter";
import { selectQueryString } from "../../../../store/selectors/queryStringSelectors";
import OfferDescription from "./OfferDescription/OfferDescription";
import CancelButton from "./CancelButton/CancelButton";
import SaveButton from "./SaveButton/SaveButton";
import { closeModal } from "../../../../store/actions/modal/modalActions";
@@ -43,6 +42,7 @@ import {
ITEM_DETAILS_PAGE,
PROFILE_PAGE,
} from "../../../../constants/pages";
import { OfferDescriptionContainer } from "./DeleteOfferLabeledCard/DeleteOfferLabeledCard.styled";

const DeleteOffer = (props) => {
const dispatch = useDispatch();
@@ -118,7 +118,7 @@ const DeleteOffer = (props) => {
)}
/>
</OfferImageContainer>
<OfferDescription
<OfferDescriptionContainer
offerName={props.offer.name}
categoryName={props.offer.category.name}
/>

+ 1
- 1
src/components/Cards/OfferCard/DeleteOffer/DeleteOffer.styled.js Voir le fichier

@@ -53,7 +53,7 @@ export const OfferImageContainer = styled(Box)`
border-radius: 2px;

@media screen and (max-width: 600px) {
margin-right: 13px;
/* margin-right: 13px; */
}
`;


+ 2
- 2
src/components/Cards/OfferCard/DeleteOffer/DeleteOfferLabeledCard/DeleteOfferLabeledCard.js Voir le fichier

@@ -1,6 +1,7 @@
import React from "react";
import PropTypes from "prop-types";
import {
OfferDescriptionContainer,
OfferImage,
OfferImageContainer,
OfferInfo,
@@ -11,7 +12,6 @@ import {
getImageUrl,
variants,
} from "../../../../../util/helpers/imageUrlGetter";
import OfferDescription from "../OfferDescription/OfferDescription";
import useIsMobile from "../../../../../hooks/useIsMobile";

const DeleteOfferLabeledCard = (props) => {
@@ -27,7 +27,7 @@ const DeleteOfferLabeledCard = (props) => {
)}
/>
</OfferImageContainer>
<OfferDescription
<OfferDescriptionContainer
offerName={props.offer.name}
categoryName={props.offer.category.name}
/>

+ 5
- 1
src/components/Cards/OfferCard/DeleteOffer/DeleteOfferLabeledCard/DeleteOfferLabeledCard.styled.js Voir le fichier

@@ -3,6 +3,7 @@ import styled from "styled-components";
import selectedTheme from "../../../../../themes";
import { ReactComponent as Remove } from "../../../../../assets/images/svg/trash-gold.svg";
import { IconButton } from "../../../../Buttons/IconButton/IconButton";
import OfferDescription from "../OfferDescription/OfferDescription";
export const OfferInfo = styled(Box)`
width: 211px;
height: 90px;
@@ -23,7 +24,7 @@ export const OfferImageContainer = styled(Box)`
border-radius: 2px;

@media screen and (max-width: 600px) {
margin-right: 13px;
/* margin-right: 13px; */
}
`;

@@ -56,3 +57,6 @@ export const RemoveIconContainer = styled(RemoveIconBorder)`
export const RemoveIcon = styled(Remove)`
cursor: default;
`;
export const OfferDescriptionContainer = styled(OfferDescription)`
margin-left: 0;
`

+ 2
- 1
src/components/Cards/OfferCard/DeleteOffer/OfferDescription/OfferDescription.js Voir le fichier

@@ -12,7 +12,7 @@ import selectedTheme from "../../../../../themes";

const OfferDescription = (props) => {
return (
<OfferDescriptionContainer>
<OfferDescriptionContainer className={props?.className}>
<OfferDescriptionTitle>{props.offerName}</OfferDescriptionTitle>
<OfferCategoryContainer>
<CategoryIconContainer
@@ -33,6 +33,7 @@ const OfferDescription = (props) => {
OfferDescription.propTypes = {
offerName: PropTypes.string,
categoryName: PropTypes.string,
className: PropTypes.string,
};

export default OfferDescription;

+ 2
- 0
src/components/Cards/RequestExchangeCard/RequestExchangeCard.styled.js Voir le fichier

@@ -20,6 +20,8 @@ export const MessageContent = styled(Box)`
min-width: 110px;
@media (max-width: 600px) {
width: 100%;
margin: 0;
${props => props.ismymessage ? "margin-right: 9px;" : "margin-left: 9px;"}
}
`;
export const MessageText = styled(Typography)`

+ 3
- 1
src/components/Cards/UserReviewsCard/UserReviewsSingleCard/ReviewQuote/ReviewQuote.styled.js Voir le fichier

@@ -19,7 +19,9 @@ export const ReviewQuoteContainer = styled(Box)`
export const ThumbContainer = styled(Grid)`
max-width: 20px;
`;
export const ReviewQuoteTextContainer = styled(Grid)``;
export const ReviewQuoteTextContainer = styled(Box)`
flex: 1;
`;
export const ReviewQuoteText = styled(Typography)`
font-family: ${selectedTheme.fonts.textFont};
font-size: 16px;

+ 15
- 7
src/components/CreateReview/CreateReview.styled.js Voir le fichier

@@ -38,17 +38,17 @@ export const CreateReviewContainer = styled(Box)`
max-width: 100vw;
left: 0;
top: 0;
padding: 0 30px;
padding: 0 18px;
}
`;
export const NextButton = styled(PrimaryButton)`
@media (max-width: 600px) {
height: 42px;
position: absolute;
bottom: 15px;
width: calc(100% - 48px);
bottom: 9px;
width: calc(100vw - 36px);
left: 0;
margin-left: 24px;
margin-left: 9px;
}
`;
export const CloseButton = styled(IconButton)`
@@ -56,8 +56,8 @@ export const CloseButton = styled(IconButton)`
top: 36px;
right: 36px;
@media (max-width: 600px) {
top: 24px;
right: 24px;
top: 32px;
right: 22px;
}
`;
export const CloseIcon = styled(Close)`
@@ -76,7 +76,7 @@ export const BackIcon = styled(Box)`
left: 36px;

@media (max-width: 600px) {
top: 24px;
top: 40px;
left: 24px;
width: 18px;
height: 18px;
@@ -101,3 +101,11 @@ export const CreateReviewTitle = styled(Typography)`
margin-bottom: 24px;
}
`;
export const CreateReviewFlexContainer = styled(Box)`
@media (max-width: 600px) {
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
}
`

+ 2
- 1
src/components/CreateReview/FirstStep/FirstStepCreateReview.js Voir le fichier

@@ -22,6 +22,7 @@ import NextButton from "./NextButton/NextButton";
const FirstStepCreateReview = (props) => {
const offer = props.offer;
const interlocutor = props.interlocutor;
console.log(props);
const { t } = useTranslation();
const handleSubmit = (values) => {
props.goToNextStep(values);
@@ -54,7 +55,7 @@ const FirstStepCreateReview = (props) => {
)}
/>
</ProfileImageContainer>
<ProfileName>{interlocutor.name}</ProfileName>
<ProfileName>{interlocutor.company.name}</ProfileName>
<LittleOfferCard
image={offer?.images[0]}
name={offer?.name}

+ 5
- 3
src/components/CreateReview/FirstStep/FirstStepCreateReview.styled.js Voir le fichier

@@ -9,7 +9,9 @@ export const FirstStepCreateReviewContainer = styled(Box)`
text-align: center;
padding: 36px;
@media (max-width: 600px) {
padding: 18px;
padding: 0;
padding-top: 36px;
flex: 1;
}
`;
export const CreateReviewTitle = styled(Typography)`
@@ -71,9 +73,9 @@ export const SelectField = styled(Select)`
text-align: left;
${props => props.exchange && `background-color: ${selectedTheme.colors.backgroundSponsoredColor};`}
@media (max-width: 600px) {
height: 33px;
height: 40px;
font-size: 14px;
margin-bottom: 12px;
margin-bottom: 18px;
}
`;
export const SelectOption = styled(Option)`

+ 13
- 13
src/components/CreateReview/SecondStep/SecondStepCreateReview.js Voir le fichier

@@ -27,20 +27,20 @@ const SecondStepCreateReview = (props) => {
: t("reviews.modalTitle")}
</CreateReviewTitle>
<ReviewCard
givingReview
profileReviews={[
{
name: mineProfile?.company?.name,
image: mineProfile?.image,
offerName: props?.offer?.name,
offerImage: props?.offer?.images[0],
isGoodCommunication: props.review?.correctCommunication,
isSuccessfulSwap: props.review?.exchangeSucceed,
quote: props.review.comment,
},
]}
givingReview={{
name: mineProfile?.company?.name,
image: mineProfile?.image,
offerName: props?.offer?.name,
offerImage: props?.offer?.images[0],
isGoodCommunication: props.review?.correctCommunication,
isSuccessfulSwap: props.review?.exchangeSucceed,
quote: props.review.comment,
}}
/>
<NextButton
removingReview={props.removingReview}
onClick={goToNextStep}
/>
<NextButton removingReview={props.removingReview} onClick={goToNextStep} />
</SecondStepCreateReviewContainer>
);
};

+ 13
- 1
src/components/CreateReview/SecondStep/SecondStepCreateReview.styled.js Voir le fichier

@@ -6,7 +6,8 @@ import UserReviews from "../../UserReviews/UserReviews";
export const SecondStepCreateReviewContainer = styled(Box)`
padding: 36px;
@media (max-width: 600px) {
padding: 18px;
padding: 0;
padding-top: 36px;
}
`;
export const ReviewCard = styled(UserReviews)`
@@ -21,4 +22,15 @@ export const ReviewCard = styled(UserReviews)`
margin: 0;
}
}
& * {
overflow:hidden;
}
@media (max-width: 600px) {
position: relative;
top: -24px;
& > div {
position: static;
margin-top: 0px;
}
}
`;

+ 2
- 1
src/components/DirectChat/DirectChat.js Voir le fichier

@@ -41,6 +41,7 @@ import {
import { convertLocalDateToUTCDate } from "../../util/helpers/dateHelpers";
import requesterStatus from "../../constants/requesterStatus";
import exchangeStatus from "../../constants/exchangeStatus";
import { NEW_CHAT } from "../../constants/chatConstants";

const DirectChat = () => {
const chat = useSelector(selectSelectedChat);
@@ -162,7 +163,7 @@ const DirectChat = () => {
}, [allChats, routeMatch, requester]);

const refreshChat = () => {
if (routeMatch.params?.chatId === "newMessage") {
if (routeMatch.params?.chatId === NEW_CHAT) {
dispatch(fetchOneOffer(location.state.offerId));
dispatch(setOneChat({}));
} else {

+ 1
- 1
src/components/DirectChat/DirectChatContent/DirectChatContent.styled.js Voir le fichier

@@ -27,7 +27,7 @@ export const MessagesList = styled(Box)`
/* justify-content: flex-end; */
/* align-items: flex-end; */
@media (max-width: 600px) {
padding: 18px 0;
padding: 18px 18px;
}
&::-webkit-scrollbar {
width: 5px;

+ 5
- 1
src/components/DirectChat/DirectChatContent/DirectChatContentHeader/DirectChatContentHeader.js Voir le fichier

@@ -103,7 +103,11 @@ const DirectChatContentHeader = (props) => {
<DirectChatHeaderStatusContainer>
<DirectChatHeaderStatusText>
{props.exchangeState === exchangeStatus.I_OFFERED
? t("messages.requestSentLong")
? isMobile
? t("messages.requestSentShort")
: t("messages.requestSentLong")
: isMobile
? t("messages.requestSuccessfulShort")
: t("messages.requestSuccessfulLong")}
</DirectChatHeaderStatusText>
</DirectChatHeaderStatusContainer>

+ 7
- 0
src/components/DirectChat/DirectChatContent/DirectChatContentHeader/DirectChatContentHeader.styled.js Voir le fichier

@@ -96,6 +96,10 @@ export const DirectChatHeaderStatusContainer = styled(Box)`
height: 39px;
width: 100%;
padding: 9px 36px;
@media (max-width: 600px) {
height: 36px;
padding: 8px 18px;
}
`;
export const DirectChatHeaderStatusText = styled(Typography)`
font-family: ${selectedTheme.fonts.textFont};
@@ -103,4 +107,7 @@ export const DirectChatHeaderStatusText = styled(Typography)`
font-size: 16px;
line-height: 21px;
color: white;
@media (max-width: 600px) {
font-size: 14px;
}
`;

+ 7
- 1
src/components/Header/Drawer/Buttons/MyProfileButton/MyProfileButton.js Voir le fichier

@@ -8,6 +8,8 @@ import { useSelector } from "react-redux";
import { selectProfileName } from "../../../../../store/selectors/profileSelectors";
import { selectUserId } from "../../../../../store/selectors/loginSelectors";
import history from "../../../../../store/utils/history";
import { PROFILE_PAGE } from "../../../../../constants/pages";
import { replaceInRoute } from "../../../../../util/helpers/routeHelpers";

const MyProfileButton = (props) => {
const name = useSelector(selectProfileName);
@@ -15,7 +17,11 @@ const MyProfileButton = (props) => {
const { t } = useTranslation();
const handleClick = () => {
props.toggleDrawer();
history.push(`/profile/${userId}`);
history.push(
replaceInRoute(PROFILE_PAGE, {
profileId: userId,
})
);
};
return (
<DrawerButton onClick={handleClick}>

+ 8
- 2
src/components/ItemDetails/ItemDetailsHeaderCard/ItemDetailsHeaderCard.js Voir le fichier

@@ -31,6 +31,7 @@ import {
DIRECT_CHAT_PAGE,
PROFILE_PAGE,
} from "../../../constants/pages";
import { NEW_CHAT } from "../../../constants/chatConstants";

const ItemDetailsHeaderCard = (props) => {
const history = useHistory();
@@ -71,8 +72,13 @@ const ItemDetailsHeaderCard = (props) => {
});
} else {
if (offer?.user?._id !== userId) {
history.push(`/messages/newMessage`, {
offerId: offer?._id,
history.push({
pathname: replaceInRoute(DIRECT_CHAT_PAGE, {
chatId: NEW_CHAT,
}),
state: {
offerId: offer?._id,
},
});
}
}

+ 6
- 1
src/components/Popovers/MyMessages/MyMessages.js Voir le fichier

@@ -47,7 +47,12 @@ export const MyMessages = (props) => {
}, [chats]);
const goToMessages = () => {
if (lastChats.length !== 0) {
history.push(`/messages/${chats[0].chat?._id}`);
console.log(chats);
history.push({
pathname: replaceInRoute(DIRECT_CHAT_PAGE, {
chatId: chats[0]._id,
}),
});
props.closePopover();
} else {
makeErrorToastMessage(t("messages.noMessagesToast"));

+ 7
- 2
src/components/UserReviews/UserReviews.js Voir le fichier

@@ -59,7 +59,7 @@ const UserReviews = (props) => {
return mineUserId;
}
return offer?.user?._id;
}, [offer]);
}, [offer, routeMatch.params]);

useEffect(() => {
if (!props?.givingReview && userId) {
@@ -67,7 +67,9 @@ const UserReviews = (props) => {
}
}, [props.givingReview, userId]);

console.log(props);
const lastThreeReviews = useMemo(() => {
if (props.givingReview) return [props.givingReview];
if (props.isProfileReviews && Array.isArray(reviews) && !props.isAdmin) {
return reviews.filter((singleReview) => {
let userWhoRecievedReview =
@@ -121,7 +123,10 @@ const UserReviews = (props) => {
};

return (
<UserReviewsContainer className={props.className}>
<UserReviewsContainer
className={props.className}
givingReview={props.givingReview}
>
{!props.givingReview &&
(isLoadingReview || isLoadingReview === undefined) ? (
<SkeletonUserReviews />

+ 3
- 1
src/components/UserReviews/UserReviews.styled.js Voir le fichier

@@ -5,7 +5,9 @@ import ThumbDownIcon from "@mui/icons-material/ThumbDown";
import selectedTheme from "../../themes";
import { ReactComponent as DownArrow } from "../../assets/images/svg/up-arrow.svg";

export const UserReviewsContainer = styled(Box)``;
export const UserReviewsContainer = styled(Box)`
${(props) => props.givingReview && `overflow: hidden;`}
`;

export const ReviewsBox = styled(Box)`
width: 100%;

+ 1
- 0
src/constants/chatConstants.js Voir le fichier

@@ -0,0 +1 @@
export const NEW_CHAT = "newChat"

+ 2
- 0
src/i18n/resources/rs.js Voir le fichier

@@ -263,7 +263,9 @@ export default {
acceptedRequest: "Prihvaćeno",
declineRequest: "Odbij",
requestSuccessfulLong: "Uspešno ste ostvarili trampu sa ovom kompanijom.",
requestSuccessfulShort: "Uspešno ste otvarili trampu.",
requestSentLong: "Ponudili ste trampu kompaniji. Čeka se odgovor...",
requestSentShort: "Ponudili ste trampu kompaniji.",
},
editProfile: {
website: "Web Sajt",

+ 5
- 5
src/pages/AdminHomePage/AdminLocationsPage/AdminLocationsPage.styled.js Voir le fichier

@@ -15,19 +15,19 @@ export const AdminLocationsPageContainer = styled(Box)`
padding: 18px;
min-height: (100vh - 72px);
padding-bottom: 100px;
top: 65px;
top: 38px;
}
`;
export const AdminLocationsHeader = styled(Header)`
top: 0;
@media (max-width: 600px) {
top: -5px;
top: 0px;
margin-top: 0px;
& > div {
margin-top: -10px;
margin-top: 0px;
}
& > div > div > div:nth-child(1) {
top: 15px;
& > div > div > div {
top: 25px;
left: 0;
}
}

+ 2
- 2
src/request/index.js Voir le fichier

@@ -6,8 +6,8 @@ const request = axios.create({
// baseURL: "http://192.168.88.175:3005/",
// baseURL: "http://192.168.88.143:3001/", // DULE
// baseURL: "https://trampa-api.dilig.net/",
// baseURL: "https://trampa-api-test.dilig.net/",
baseURL: "http://localhost:3001/",
baseURL: "https://trampa-api-test.dilig.net/",
// baseURL: "http://localhost:3001/",
// baseURL: process.env.REACT_APP_BASE_API_URL,
headers: {
"Content-Type": "application/json",

+ 2
- 2
src/store/middleware/accessTokensMiddleware.js Voir le fichier

@@ -16,9 +16,9 @@ import { logoutUser, refreshUserToken } from "../actions/login/loginActions";
// const baseURL = "http://192.168.88.143:3001/"; // DULE
// const baseURL = "http://192.168.88.175:3005/";
// const baseURL = "https://trampa-api.dilig.net/";
// const baseURL = "https://trampa-api-test.dilig.net/";
const baseURL = "https://trampa-api-test.dilig.net/";
// const baseURL = "http://192.168.88.150:3001/"; // DJOLE
const baseURL = "http://localhost:3001/";
// const baseURL = "http://localhost:3001/";
// const baseURL = process.env.REACT_APP_BASE_API_URL

//Interceptor unique name

+ 8
- 2
src/util/helpers/chatHelper.js Voir le fichier

@@ -1,3 +1,4 @@
import { NEW_CHAT } from "../../constants/chatConstants";
import { DIRECT_CHAT_PAGE } from "../../constants/pages";
import history from "../../store/utils/history";
import { replaceInRoute } from "./routeHelpers";
@@ -10,8 +11,13 @@ export const startChat = (chats, offer, userId) => {
history.push(replaceInRoute(DIRECT_CHAT_PAGE, { chatId: chatItem?._id }));
} else {
if (offer?.user?._id !== userId) {
history.push(`/messages/newMessage`, {
offerId: offer?._id,
history.push({
pathname: replaceInRoute(DIRECT_CHAT_PAGE, {
chatId: NEW_CHAT,
}),
state: {
offerId: offer?._id,
},
});
}
}

+ 6
- 2
src/util/helpers/messageHelper.js Voir le fichier

@@ -1,3 +1,4 @@
import { NEW_CHAT } from "../../constants/chatConstants";
import { DIRECT_CHAT_PAGE } from "../../constants/pages";
import history from "../../store/utils/history";
import { replaceInRoute } from "./routeHelpers";
@@ -12,8 +13,11 @@ export const messageUserHelper = (chats, userId, offer) => {
);
} else {
if (offer?.offer?.userId !== userId) {
history.push(replaceInRoute(DIRECT_CHAT_PAGE, { chatId: "newMessage" }), {
offerId: offer?.offer?._id,
history.push({
pathname: replaceInRoute(DIRECT_CHAT_PAGE, { chatId: NEW_CHAT }),
state: {
offerId: offer?.offer?._id,
},
});
}
}

Chargement…
Annuler
Enregistrer