| { | { | ||||
| "name": "web", | "name": "web", | ||||
| "version": "0.1.0", | |||||
| "version": "2.0.4", | |||||
| "lockfileVersion": 1, | "lockfileVersion": 1, | ||||
| "requires": true, | "requires": true, | ||||
| "dependencies": { | "dependencies": { | ||||
| } | } | ||||
| } | } | ||||
| }, | }, | ||||
| "@rive-app/canvas": { | |||||
| "version": "1.0.83", | |||||
| "resolved": "https://registry.npmjs.org/@rive-app/canvas/-/canvas-1.0.83.tgz", | |||||
| "integrity": "sha512-IARYWsnh1NPWY2wTYZ15TBg8Bbe9LEPGSHHd8TivmCfagK61WtAPiPjApGUN3Fbk0MUWjmbNwtv9aK3x7QRkog==" | |||||
| }, | |||||
| "@rive-app/webgl": { | |||||
| "version": "1.0.79", | |||||
| "resolved": "https://registry.npmjs.org/@rive-app/webgl/-/webgl-1.0.79.tgz", | |||||
| "integrity": "sha512-zP8q0D1EOvS0bllhRy3iWwwLxsZ6y7Q01HdZNWo4tNui6EDRC7DRNr40mLSMDKqgF79eZo9vf3lkk8/Wai0fsA==" | |||||
| }, | |||||
| "@rollup/plugin-node-resolve": { | "@rollup/plugin-node-resolve": { | ||||
| "version": "7.1.3", | "version": "7.1.3", | ||||
| "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz", | "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz", | ||||
| "inherits": "^2.0.1" | "inherits": "^2.0.1" | ||||
| } | } | ||||
| }, | }, | ||||
| "rive-react": { | |||||
| "version": "3.0.23", | |||||
| "resolved": "https://registry.npmjs.org/rive-react/-/rive-react-3.0.23.tgz", | |||||
| "integrity": "sha512-CMJaWgnVEZKLAsu5p1bBkBniCbaTLI+kqBh++y3XdK2aG4MCfYgxYr90rHstn/z4VW8/NP/i/l1NRYxrzgSgsw==", | |||||
| "requires": { | |||||
| "@rive-app/canvas": "1.0.83", | |||||
| "@rive-app/webgl": "1.0.79" | |||||
| } | |||||
| }, | |||||
| "rollup": { | "rollup": { | ||||
| "version": "1.32.1", | "version": "1.32.1", | ||||
| "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.32.1.tgz", | "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.32.1.tgz", |
| "redux-persist": "^6.0.0", | "redux-persist": "^6.0.0", | ||||
| "redux-persist-transform-filter": "0.0.20", | "redux-persist-transform-filter": "0.0.20", | ||||
| "redux-saga": "^1.1.3", | "redux-saga": "^1.1.3", | ||||
| "rive-react": "^3.0.23", | |||||
| "sass": "^1.34.1", | "sass": "^1.34.1", | ||||
| "socket.io": "^4.5.1", | "socket.io": "^4.5.1", | ||||
| "socket.io-client": "^4.5.1", | "socket.io-client": "^4.5.1", |
| setIsConnected(false); | setIsConnected(false); | ||||
| }); | }); | ||||
| socket.on("user disconnected", (userID) => { | |||||
| console.log(userID); | |||||
| }); | |||||
| // socket.on("user disconnected", (userID) => { | |||||
| // console.log(userID); | |||||
| // }); | |||||
| // socket.on('emit', (client) => { | |||||
| // console.log(client); | |||||
| // }) | |||||
| socket.on("sokkk", (clg) => { | |||||
| console.log(clg); | |||||
| }); | |||||
| // socket.onAny((event, ...args) => { | |||||
| // console.log(event, args); | |||||
| // }); | |||||
| socket.on("povratna", (data) => { | |||||
| console.log(data); | |||||
| }); | |||||
| socket.on("private_message", (data) => { | |||||
| console.log(data); | |||||
| }); | |||||
| // // socket.on('emit', (client) => { | |||||
| // // console.log(client); | |||||
| // // }) | |||||
| // socket.on("sokkk", (clg) => { | |||||
| // console.log(clg); | |||||
| // }); | |||||
| // // socket.onAny((event, ...args) => { | |||||
| // // console.log(event, args); | |||||
| // // }); | |||||
| // socket.on("povratna", (data) => { | |||||
| // console.log(data); | |||||
| // }); | |||||
| // socket.on("private_message", (data) => { | |||||
| // console.log(data); | |||||
| // }); | |||||
| // socket.open; | |||||
| // // socket.open; | |||||
| socket.on("pong", () => { | |||||
| setLastPong(new Date().toISOString()); | |||||
| }); | |||||
| // socket.on("pong", () => { | |||||
| // setLastPong(new Date().toISOString()); | |||||
| // }); | |||||
| // socket.connect(); | |||||
| // // socket.connect(); | |||||
| return () => { | return () => { | ||||
| socket.off("connect"); | socket.off("connect"); |
| return ( | return ( | ||||
| <CheckboxButton | <CheckboxButton | ||||
| leftText={item.city} | leftText={item.city} | ||||
| rightText={item.offerCount} | |||||
| // rightText={item.offerCount} | |||||
| value={item} | value={item} | ||||
| checked={ | checked={ | ||||
| props.filters.find( | props.filters.find( |
| setImage(reader.result); | setImage(reader.result); | ||||
| }; | }; | ||||
| reader.onerror = (error) => { | reader.onerror = (error) => { | ||||
| console.log(error); | |||||
| console.dir(error); | |||||
| }; | }; | ||||
| }; | }; | ||||
| const handleDelete = () => { | const handleDelete = () => { |
| // }, [formik.isValid]) | // }, [formik.isValid]) | ||||
| useEffect(() => { | useEffect(() => { | ||||
| console.log(error); | |||||
| console.dir(error); | |||||
| }, [error]) | }, [error]) | ||||
| return ( | return ( |
| }; | }; | ||||
| const handleResponseError = (error) => { | const handleResponseError = (error) => { | ||||
| console.log(error); | |||||
| console.dir(error); | |||||
| const { mail, password, PIB, image } = informations; | const { mail, password, PIB, image } = informations; | ||||
| if (error.type === "mail") { | if (error.type === "mail") { | ||||
| setInformations({ image }); | setInformations({ image }); |
| RegisterDescription, | RegisterDescription, | ||||
| RegisterTitle, | RegisterTitle, | ||||
| } from "./RegisterSuccessful.styled"; | } from "./RegisterSuccessful.styled"; | ||||
| import { ReactComponent as Success } from "../../../assets/images/svg/register-success.svg"; | |||||
| import { useTranslation } from "react-i18next"; | import { useTranslation } from "react-i18next"; | ||||
| import { useHistory } from "react-router-dom"; | import { useHistory } from "react-router-dom"; | ||||
| import { LOGIN_PAGE } from "../../../constants/pages"; | |||||
| import { HOME_PAGE } from "../../../constants/pages"; | |||||
| import RegisterRiv from "../../../assets/animations/register.riv"; | |||||
| import { useRive } from "rive-react"; | |||||
| const RegisterSuccessful = () => { | const RegisterSuccessful = () => { | ||||
| const { t } = useTranslation(); | const { t } = useTranslation(); | ||||
| //Redirect to Login page when registration is successful | //Redirect to Login page when registration is successful | ||||
| useEffect(() => { | useEffect(() => { | ||||
| setTimeout(() => { | setTimeout(() => { | ||||
| history.replace(LOGIN_PAGE); | |||||
| }, 2500); | |||||
| history.replace(HOME_PAGE); | |||||
| }, 1700); | |||||
| }, []); | }, []); | ||||
| const { RiveComponent } = useRive({ | |||||
| src: RegisterRiv, | |||||
| autoplay: true, | |||||
| }); | |||||
| return ( | return ( | ||||
| <RegisterSuccessfulContainer> | <RegisterSuccessfulContainer> | ||||
| <Success /> | |||||
| <RiveComponent /> | |||||
| <RegisterTitle component="h1" variant="h5"> | <RegisterTitle component="h1" variant="h5"> | ||||
| {t("register.success")} | {t("register.success")} |
| flex-direction: column; | flex-direction: column; | ||||
| align-items: center; | align-items: center; | ||||
| width: 536px; | width: 536px; | ||||
| height: 200px; | |||||
| padding: 0; | padding: 0; | ||||
| & div canvas { | |||||
| height: 300px; | |||||
| } | |||||
| `; | `; | ||||
| export const RegisterTitle = styled(Typography)` | export const RegisterTitle = styled(Typography)` | ||||
| font-family: "Mulish"; | font-family: "Mulish"; |
| const request = axios.create({ | const request = axios.create({ | ||||
| // baseURL: "http://192.168.88.150:3001/", | // baseURL: "http://192.168.88.150:3001/", | ||||
| // baseURL: "http://192.168.88.175:3005/", | // baseURL: "http://192.168.88.175:3005/", | ||||
| baseURL: "https://trampa-api-test.dilig.net/", | |||||
| baseURL: "http://192.168.88.143:3001/", | |||||
| headers: { | headers: { | ||||
| "Content-Type": "application/json", | "Content-Type": "application/json", | ||||
| }, | }, |
| // import { setUserAccessToken } from "../actions/user/userActions"; | // import { setUserAccessToken } from "../actions/user/userActions"; | ||||
| //Change URL with .env | //Change URL with .env | ||||
| const baseURL = "https://trampa-api-test.dilig.net/"; | |||||
| const baseURL = "http://192.168.88.143:3001/"; | |||||
| // const baseURL = "http://192.168.88.175:3005/"; | // const baseURL = "http://192.168.88.175:3005/"; | ||||
| // const baseURL = "http://192.168.88.175:3005/"; | // const baseURL = "http://192.168.88.175:3005/"; | ||||
| yield put(fetchCategoriesSuccess()); | yield put(fetchCategoriesSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(fetchCategoriesError()); | yield put(fetchCategoriesError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| yield put(fetchChatsSuccess()); | yield put(fetchChatsSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(fetchChatsError()); | yield put(fetchChatsError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| yield put(fetchHeaderChatsSuccess()); | yield put(fetchHeaderChatsSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(fetchHeaderChatsError()); | yield put(fetchHeaderChatsError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| function* fetchOneChat(payload) { | function* fetchOneChat(payload) { | ||||
| yield put(fetchOneChatSuccess()); | yield put(fetchOneChatSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(fetchOneChatError()); | yield put(fetchOneChatError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(sendMessageError()); | yield put(sendMessageError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| function* startNewChat(payload) { | function* startNewChat(payload) { | ||||
| } | } | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(startNewChatError()); | yield put(startNewChatError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| yield put(increaseCounterSuccess()); | yield put(increaseCounterSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(increaseCounterError()); | yield put(increaseCounterError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| catch (e) { | catch (e) { | ||||
| yield put(fetchExchangeError()); | yield put(fetchExchangeError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| catch(e) { | catch(e) { | ||||
| yield put(validateExchangeError()); | yield put(validateExchangeError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| catch(e) { | catch(e) { | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| if (payload.handleResponseError) { | if (payload.handleResponseError) { | ||||
| yield call(payload.handleResponseError); | yield call(payload.handleResponseError); | ||||
| } | } |
| yield call(payload.payload) | yield call(payload.payload) | ||||
| } | } | ||||
| } catch (error) { | } catch (error) { | ||||
| console.log(error); // eslint-disable-line | |||||
| console.dir(error); // eslint-disable-line | |||||
| } finally { | } finally { | ||||
| yield call(authScopeClearHelper); | yield call(authScopeClearHelper); | ||||
| yield call(removeHeaderToken); | yield call(removeHeaderToken); | ||||
| return true; | return true; | ||||
| } | } | ||||
| catch(e){ | catch(e){ | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| return false; | return false; | ||||
| } | } | ||||
| } | } |
| yield put(fetchMoreOffersSuccess()); | yield put(fetchMoreOffersSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(fetchMoreOffersError()); | yield put(fetchMoreOffersError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(addOfferError()); | yield put(addOfferError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| yield put(fetchMineOffersSuccess()); | yield put(fetchMineOffersSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(fetchMineOffersError()); | yield put(fetchMineOffersError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| yield put(setProfileOffers(data.data)); | yield put(setProfileOffers(data.data)); | ||||
| yield put(fetchProfileOffersSuccess()); | yield put(fetchProfileOffersSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| if (e.response.status === 400) { | if (e.response.status === 400) { | ||||
| yield call(history.push, NOT_FOUND_PAGE); | yield call(history.push, NOT_FOUND_PAGE); | ||||
| } | } | ||||
| } | } | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(removeOfferError()); | yield put(removeOfferError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(editOfferError()); | yield put(editOfferError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| yield put(fetchProfileSuccess()); | yield put(fetchProfileSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(fetchErrorProfile()); | yield put(fetchErrorProfile()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| yield put(fetchMineProfileSuccess()); | yield put(fetchMineProfileSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(fetcHMineProfileError()); | yield put(fetcHMineProfileError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| console.log(data); | console.log(data); | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(editMineProfileError()); | yield put(editMineProfileError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| const newQueryString = convertQueryStringForBackend(payload.payload); | const newQueryString = convertQueryStringForBackend(payload.payload); | ||||
| yield put(setQueryStringRedux(newQueryString)); | yield put(setQueryStringRedux(newQueryString)); | ||||
| } catch (e) { | } catch (e) { | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| import { all, takeLatest, call, put } from "@redux-saga/core/effects"; | import { all, takeLatest, call, put } from "@redux-saga/core/effects"; | ||||
| import { JWT_REFRESH_TOKEN, JWT_TOKEN } from "../../constants/localStorage"; | |||||
| import { addHeaderToken } from "../../request"; | |||||
| import { attemptLogin } from "../../request/loginRequest"; | |||||
| import { attemptFetchProfile } from "../../request/profileRequest"; | |||||
| import { attemptRegister } from "../../request/registerRequest"; | import { attemptRegister } from "../../request/registerRequest"; | ||||
| import { authScopeSetHelper } from "../../util/helpers/authScopeHelpers"; | |||||
| import { | |||||
| fetchUserError, | |||||
| fetchUserSuccess, | |||||
| } from "../actions/login/loginActions"; | |||||
| import { setMineProfile } from "../actions/profile/profileActions"; | |||||
| import { REGISTER_USER_FETCH } from "../actions/register/registerActionConstants"; | import { REGISTER_USER_FETCH } from "../actions/register/registerActionConstants"; | ||||
| import jwt from "jsonwebtoken"; | |||||
| import { | import { | ||||
| fetchRegisterUserError, | fetchRegisterUserError, | ||||
| fetchRegisterUserSuccess, | fetchRegisterUserSuccess, | ||||
| } from "../actions/register/registerActions"; | } from "../actions/register/registerActions"; | ||||
| import { rejectErrorCodeHelper } from "../../util/helpers/rejectErrorCodeHelper"; | |||||
| import i18next from "i18next"; | |||||
| function* fetchRegisterUser({ payload }) { | function* fetchRegisterUser({ payload }) { | ||||
| try { | try { | ||||
| if (payload.values.website?.length === 0) | if (payload.values.website?.length === 0) | ||||
| delete requestData.company.contacts.web; | delete requestData.company.contacts.web; | ||||
| yield call(attemptRegister, requestData); | yield call(attemptRegister, requestData); | ||||
| const { data } = yield call(attemptLogin, { | |||||
| email: payload.values.mail, | |||||
| password: payload.values.password, | |||||
| }); | |||||
| if (data.token) { | |||||
| const token = data.token; | |||||
| const refresh = data.refresh; | |||||
| const tokenDecoded = jwt.decode(token); | |||||
| const refreshDecoded = jwt.decode(refresh); | |||||
| const accessToken = { | |||||
| token: token, | |||||
| exp: tokenDecoded.exp, | |||||
| }; | |||||
| const refreshToken = { | |||||
| token: refresh, | |||||
| exp: refreshDecoded.exp, | |||||
| }; | |||||
| const userId = tokenDecoded._id; | |||||
| yield call(authScopeSetHelper, JWT_TOKEN, token); | |||||
| yield call(authScopeSetHelper, JWT_REFRESH_TOKEN, refresh); | |||||
| yield call(addHeaderToken, token); | |||||
| const profileData = yield call(attemptFetchProfile, userId); | |||||
| if (profileData) yield put(setMineProfile(profileData.data)); | |||||
| yield put( | |||||
| fetchUserSuccess({ | |||||
| JwtToken: accessToken, | |||||
| RefreshToken: refreshToken, | |||||
| userId, | |||||
| }) | |||||
| ); | |||||
| } | |||||
| if (payload.handleResponseSuccess) { | if (payload.handleResponseSuccess) { | ||||
| yield call(payload.handleResponseSuccess); | yield call(payload.handleResponseSuccess); | ||||
| } | } | ||||
| yield put(fetchRegisterUserSuccess()); | yield put(fetchRegisterUserSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| let type = "server"; | let type = "server"; | ||||
| if ( | if ( | ||||
| e?.response?.data?.toString() === "User with email already exists!" || | e?.response?.data?.toString() === "User with email already exists!" || | ||||
| if (payload.handleResponseError) { | if (payload.handleResponseError) { | ||||
| yield call(payload.handleResponseError, error); | yield call(payload.handleResponseError, error); | ||||
| } | } | ||||
| if (e.response && e.response.data) { | |||||
| console.log(e.response.status); | |||||
| let errorMessage = yield call(rejectErrorCodeHelper, e.response.status); | |||||
| if (e.response.status === 400 || e.response.status === 404) { | |||||
| errorMessage = i18next.t("login.wrongCredentials", { | |||||
| lng: "rs", | |||||
| }); | |||||
| } | |||||
| yield put(fetchUserError(errorMessage)); | |||||
| } | |||||
| yield put(fetchRegisterUserError()); | yield put(fetchRegisterUserError()); | ||||
| } | } | ||||
| } | } |
| yield put(fetchReviewsSuccess()); | yield put(fetchReviewsSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(fetchReviewsError()); | yield put(fetchReviewsError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||
| yield put(giveReviewSuccess()); | yield put(giveReviewSuccess()); | ||||
| } catch (e) { | } catch (e) { | ||||
| yield put(giveReviewError()); | yield put(giveReviewError()); | ||||
| console.log(e); | |||||
| console.dir(e); | |||||
| } | } | ||||
| } | } | ||||