Kaynağa Gözat

Fixed bug

bugfix/1919
Djordje Mitrovic 3 yıl önce
ebeveyn
işleme
63b4d91249

+ 1
- 1
.env.example Dosyayı Görüntüle

@@ -1,2 +1,2 @@

REACT_APP_BASE_API_URL=${REACT_APP_BASE_API_URL}
REACT_APP_BASE_API_URL=https://trampa-api-test.dilig.net/

+ 1
- 1
package.json Dosyayı Görüntüle

@@ -1,6 +1,6 @@
{
"name": "web",
"version": "4.0.10",
"version": "4.0.12",
"private": true,
"dependencies": {
"@emotion/react": "^11.5.0",

+ 5
- 7
src/components/Header/Header.js Dosyayı Görüntüle

@@ -77,6 +77,7 @@ const Header = () => {

useEffect(() => {
if (logoClicked) {
console.log("clicked");
if (isAdminRoute()) {
history.push({
pathname: ADMIN_HOME_PAGE,
@@ -93,6 +94,7 @@ const Header = () => {
},
});
} else {
console.log("odje");
history.push({
pathname: MARKETPLACE_PAGE,
state: {
@@ -133,15 +135,12 @@ const Header = () => {
// When user clicks logo, he sends specific state so filters can be removed
const handleLogoClick = () => {
if (
!(
routeMatches(HOME_PAGE) ||
routeMatches(BASE_PAGE) ||
routeMatches(MARKETPLACE_PAGE)
)
((routeMatches(HOME_PAGE) || routeMatches(BASE_PAGE)) && user) ||
routeMatches(MARKETPLACE_PAGE)
) {
dispatch(clearFilters());
setLogoClicked(true);
}
setLogoClicked(true);
};

const handleAddOfferClick = () => {
@@ -151,7 +150,6 @@ const Header = () => {
if (!shouldShow) {
return <></>;
}
console.log(history);

return (
<HeaderContainer>

+ 0
- 1
src/components/TextFields/TextField/TextField.js Dosyayı Görüntüle

@@ -14,7 +14,6 @@ export const TextField = React.forwardRef((props, ref) => {
setIsFieldEmpty(false);
}
}, [props.value]);
console.log(props);
return (
<TextFieldContainer
style={props.containerStyle}

+ 3
- 2
src/i18n/resources/rs.js Dosyayı Görüntüle

@@ -116,6 +116,7 @@ export default {
locationError: "Odaberite ispravnu lokaciju!",
websiteError: "Unesite ispravnu adresu svog website!",
websiteRequired: "Website je obavezan!",
companyNameError: "Naziv kompanije je zauzet!",
},
forgotPassword: {
title: "Povrati lozinku",
@@ -609,6 +610,6 @@ export default {
gray: "Siva",
yellow: "Žuta",
purple: "Ljubičasta",
pink: "Roze"
}
pink: "Roze",
},
};

+ 19
- 6
src/pages/RegisterPages/Register/Register.js Dosyayı Görüntüle

@@ -39,8 +39,11 @@ const Register = () => {
const [mailErrorMessage, setMailErrorMessage] = useState(""); // Error message caused by typing wrong mail
const [PIBError, setPIBError] = useState(""); // Wrong PIB typed
const [PIBErrorMessage, setPIBErrorMessage] = useState(""); // Error message caused by typing wrong PIB
const [companyNameError, setCompanyNameError] = useState("");
const [imageError, setImageError] = useState(false); // Not picked image
const isLoadingRegister = useSelector(selectIsLoadingByActionType(REGISTER_USER_SCOPE));
const isLoadingRegister = useSelector(
selectIsLoadingByActionType(REGISTER_USER_SCOPE)
);

const handleResponseSuccess = () => {
history.push(REGISTER_SUCCESSFUL_PAGE);
@@ -48,7 +51,8 @@ const Register = () => {

const handleResponseError = (error) => {
console.dir(error);
const { mail, password, PIB, image } = informations;
console.log("informations", informations);
const { mail, registerPassword, PIB, image } = informations;
if (error.type === "mail") {
setInformations({ image });
setCurrentStep(1);
@@ -65,16 +69,24 @@ const Register = () => {
error?.error?.response?.data?.toString() ===
"User with PIB already exists!"
) {
setInformations({ mail, password, image });
setInformations({ mail, registerPassword, image });
setCurrentStep(2);
setPIBError(PIB.toString());
setPIBErrorMessage(t("register.PIBTaken"));
} else {
makeErrorToastMessage(t("register.serverError"));
}
} else if (
error?.error?.response?.data?.toString() ===
"Company with that name already exists!"
) {
setInformations({ mail, registerPassword, image });
setCurrentStep(2);
setCompanyNameError(t("register.companyNameError"));
} else makeErrorToastMessage(t("register.serverError"));
};

const registerUser = (values) => {
setCompanyNameError("");
setPIBErrorMessage("");
setMailErrorMessage("");
dispatch(
fetchRegisterUser({ values, handleResponseSuccess, handleResponseError })
);
@@ -151,6 +163,7 @@ const Register = () => {
informations={informations}
error={PIBError}
errorMessage={PIBErrorMessage}
companyNameError={companyNameError}
/>
)}
{currentStep === 3 && (

+ 13
- 5
src/pages/RegisterPages/Register/SecondPart/SecondPartOfRegistration.js Dosyayı Görüntüle

@@ -25,9 +25,9 @@ const SecondPartOfRegistration = (props) => {
useEffect(() => {
if (props.informations?.nameOfFirm) {
formik.setFieldValue("nameOfFirm", props.informations?.nameOfFirm);
formik.setFieldValue("PIB", props.informations.PIB)
formik.setFieldValue("PIB", props.informations.PIB);
}
}, [props.informations])
}, [props.informations]);

const formik = useFormik({
initialValues: {
@@ -57,7 +57,10 @@ const SecondPartOfRegistration = (props) => {
margin="normal"
value={formik.values.nameOfFirm}
onChange={formik.handleChange}
error={formik.touched.nameOfFirm && Boolean(formik.errors.nameOfFirm)}
error={
(formik.touched.nameOfFirm && Boolean(formik.errors.nameOfFirm)) ||
props?.companyNameError
}
helperText={formik.touched.nameOfFirm && formik.errors.nameOfFirm}
autoFocus
fullWidth
@@ -70,7 +73,7 @@ const SecondPartOfRegistration = (props) => {
type="number"
value={formik.values.PIB}
onChange={(event) => {
formik.setFieldValue("PIB", event.target.value)
formik.setFieldValue("PIB", event.target.value);
}}
error={
(formik.touched.PIB && Boolean(formik.errors.PIB)) || PIBTakenStatus
@@ -81,7 +84,11 @@ const SecondPartOfRegistration = (props) => {
{formik.errors.PIB && formik.touched.PIB && (
<ErrorMessage>{formik.errors.PIB}</ErrorMessage>
)}
{props.error && <ErrorMessage>{props.errorMessage}</ErrorMessage>}
{(props.error || props?.companyNameError) && (
<ErrorMessage>
{props.errorMessage || props?.companyNameError}
</ErrorMessage>
)}

<PrimaryButton
type="submit"
@@ -108,6 +115,7 @@ SecondPartOfRegistration.propTypes = {
informations: PropTypes.any,
error: PropTypes.string,
errorMessage: PropTypes.string,
companyNameError: PropTypes.string,
};

export default SecondPartOfRegistration;

Loading…
İptal
Kaydet