merge work

This commit is contained in:
Grégoire
2019-10-11 12:21:35 +02:00
28 changed files with 272 additions and 106 deletions
+3 -1
View File
@@ -4,4 +4,6 @@
.env
ecosystem.config.js
yarn-error.log
robots.txt
robots.txt
/out/
yarn.lock
+2
View File
@@ -51,3 +51,5 @@ https://github.com/levz0r/gmail-tester
>in case of emergency
make docker-restart ENV=dev
adduser jenkins root
+18 -1
View File
@@ -25,7 +25,10 @@ import {
SUBSCRIBE_USER_TO_PUSH_FAILURE,
IS_USER_SUBSCRIBED_TO_PUSH_REQUEST,
IS_USER_SUBSCRIBED_TO_PUSH_SUCCESS,
IS_USER_SUBSCRIBED_TO_PUSH_FAILURE
IS_USER_SUBSCRIBED_TO_PUSH_FAILURE,
UPDATE_USER_PICTURE_REQUEST,
UPDATE_USER_PICTURE_SUCCESS,
UPDATE_USER_PICTURE_FAILURE
} from '../types'
@@ -156,3 +159,17 @@ export const isUserSubscribedToPushFailure = (err) => ({
type: IS_USER_SUBSCRIBED_TO_PUSH_FAILURE,
err
});
export const updateUserPictureRequest = (payload) => ({
type: UPDATE_USER_PICTURE_REQUEST,
payload
})
export const updateUserPictureSuccess = (data) => ({
type: UPDATE_USER_PICTURE_SUCCESS,
data
})
export const updateUserPictureFailure = (err) => ({
type: UPDATE_USER_PICTURE_FAILURE,
err
})
+68 -16
View File
@@ -1,12 +1,15 @@
import React, { Component, Fragment } from 'react'
import { withStyles } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';
import { Button, Typography } from '@material-ui/core';
import TextField from '@material-ui/core/TextField';
import Input from '@material-ui/core/Input';
import { connect } from 'react-redux'
import { postAdAnswerRequest } from '../../actions/answer'
import { updateUserRequest } from '../../actions/user'
import { updateUserRequest, updateUserPictureRequest } from '../../actions/user'
import Avatar from '@material-ui/core/Avatar';
import KeyboardArrowRightIcon from '@material-ui/icons/KeyboardArrowRight';
import Loader from './../templates/loader'
import getConfig from 'next/config'
const styles = theme => ({
container: {
@@ -71,8 +74,24 @@ const styles = theme => ({
color: theme.palette.secondary.main,
backgroundColor: theme.palette.primary.important,
},
importButton: {
color: theme.palette.primary.main,
backgroundColor: theme.palette.secondary.main,
padding: theme.spacing(3, 2),
margin: theme.spacing(1),
boxShadow: '0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12), 0 3px 5px -1px rgba(0, 0, 0, 0.14)',
'&:hover': {
backgroundColor: theme.palette.secondary.main,
},
InputKeyboardArrowRightIcon: {
fontSize: '2.5em',
color: theme.palette.secondary.main,
},
},
});
const { publicRuntimeConfig } = getConfig()
//https://xd.adobe.com/view/ba98331a-9145-4d67-7e27-25a36e519ef4-cca9/screen/a96779d7-bdb3-410a-8f19-e6987acb98ee/Candidature-Step-3
class Answer extends Component {
@@ -93,7 +112,7 @@ class Answer extends Component {
twitter: '',
website: '',
mediaId: null,
companyId: null
companyId: null,
};
handleChange = (e) => {
@@ -110,7 +129,7 @@ class Answer extends Component {
twitter: nextProps.user.twitter,
website: nextProps.user.website,
mediaId: nextProps.mediaId,
companyId: nextProps.companyId
companyId: nextProps.companyId,
})
}
@@ -131,7 +150,6 @@ class Answer extends Component {
const data = new FormData()
data.append('file', this.state.file)
data.append('firstname', this.state.firstname)
data.append('lastname', this.state.lastname)
data.append('phone', this.state.phone)
@@ -140,28 +158,61 @@ class Answer extends Component {
data.append('twitter', this.state.twitter)
data.append('website', this.state.website)
//TODO:maybe add this two in a single saga
//TODO:maybe add this two in a single transactionnal saga
this.props.updateUserRequest(data)
this.props.postAdAnswerRequest({ adId: this.props.adId, companyId: this.props.companyId, mediaId: this.props.mediaId })
console.log(this.props.adId)
console.log(this.props.companyId)
console.log(this.props.mediaId)
this.props.postAdAnswerRequest(
{
adId: this.props.adId,
companyId: this.props.companyId,
mediaId: this.props.mediaId
})
}
inputFilesystemChange = (e) => {
console.log("inputFilesystemChange");
var file = e.target.files[0]
this.setState({ file: file })
//TODO : updateProfile pict
this.setState({ picture: file })
const data = new FormData()
data.append('file', file)
this.props.updateUserPictureRequest(data)
}
render() {
const { classes, user } = this.props
const logoUrl = user.picture;
return (
<section className={classes.container}>
<form className={classes.form}
autoComplete="off">
{!!logoUrl && <Avatar className={classes.logo}
classes={{ img: classes.MuiAvatarImg }}
src={publicRuntimeConfig.symphonyUrl + publicRuntimeConfig.postedContentUrl + logoUrl} alt="candidatLogo" />}
{!!user.pictureLoading && <Loader />}
{!!!user.pictureLoading && !!!logoUrl &&
(<Fragment><input
type="file" accept="image/*" capture="filesystem"
className={classes.input}
style={{ display: 'none' }}
id="raised-button-file"
multiple
type="file"
onChange={this.inputFilesystemChange}
/>
<label htmlFor="raised-button-file">
<Button component="span" className={classes.importButton} classes={{ root: classes.rootButton }}>
<img alt="talents-tube" src='/static/images/default/account-avatar-default.svg'
className={classes.iconButton} />
<Typography align="left" className={classes.textButton}>
J'<span className={classes.underlined}>importe</span> ma photo de profil
</Typography>
<KeyboardArrowRightIcon className={classes.InputKeyboardArrowRightIcon} />
</Button>
</label></Fragment>)
}
<TextField
name="lastname"
required
@@ -195,6 +246,7 @@ class Answer extends Component {
variant="outlined"
value={this.state.phone}
onChange={this.handleChange}
type="tel"
/>
<TextField
@@ -267,10 +319,10 @@ function mapStateToProps(state, ownProps) {
return {
user: state.user,
loading: !!state.user.loading,
pictureLoading: !!state.user.pictureLoading,
errors: state.user.errors || ownProps.errors,
mediaId: state.media.message && state.media.message.mediaId,
};
}
export default withStyles(styles)(connect(mapStateToProps, { postAdAnswerRequest, updateUserRequest })(Answer))
export default withStyles(styles)(connect(mapStateToProps, { postAdAnswerRequest, updateUserRequest, updateUserPictureRequest })(Answer))
+2 -2
View File
@@ -173,7 +173,7 @@ class AnswerRowComponent extends React.Component {
const imgUrl = (rowData.ad && rowData.ad.video && rowData.ad.video.thumbnails[0] && rowData.ad.video.thumbnails[0].sizes[4])
? rowData.ad.video.thumbnails[0].sizes[4].link
: publicRuntimeConfig.adListDefaultUrl
const logoUrl = publicRuntimeConfig.logoRootUrl + companyR.logo
const logoUrl = publicRuntimeConfig.symphonyUrl + publicRuntimeConfig.cachedMediaUrl + companyR.logo
return (
<Link href={`/Candidature/${rowData.id}`} >
@@ -214,7 +214,7 @@ class AnswerRowComponent extends React.Component {
<CardContent className={classes.content}>
<CardMedia
className={classes.cover}
image={publicRuntimeConfig.logoRootUrl + rowData.company.logo}
image={publicRuntimeConfig.symphonyUrl + publicRuntimeConfig.cachedMediaUrl + rowData.company.logo}
title={rowData.company.brand_name}
>
<KeyboardArrowleftIcon className={classes.iconPlay} />
+1 -1
View File
@@ -142,7 +142,7 @@ class CompanyRowComponent extends React.Component {
const imgDefaultUrl = "/static/images/default/default_picture_company.svg"
const imgUrl = (rowData.presentation_video && rowData.presentation_video.thumbnails[0] && rowData.presentation_video.thumbnails[0].sizes[4]) ? rowData.presentation_video.thumbnails[0].sizes[4].link : imgDefaultUrl
const logoUrl = publicRuntimeConfig.logoRootUrl + rowData.logo
const logoUrl = publicRuntimeConfig.symphonyUrl + publicRuntimeConfig.cachedMediaUrl + rowData.logo
let location = "non renseigné"
if (rowData.addresses && rowData.addresses.billing && rowData.addresses.billing.city && rowData.addresses.billing.postcode)
location = (rowData.addresses.billing.city.toLowerCase() + ', ' + rowData.addresses.billing.postcode);
+1 -1
View File
@@ -293,7 +293,7 @@ const { publicRuntimeConfig } = getConfig()
function OffreDetail(props) {
let { classes, offre, isCandidature } = props;
const logoUrl = (offre.company ? publicRuntimeConfig.logoRootUrl + offre.company.logo : "/static/images/defaultdefault_picture_company.svg/")
const logoUrl = (offre.company ? publicRuntimeConfig.symphonyUrl + publicRuntimeConfig.cachedMediaUrl + offre.company.logo : "/static/images/defaultdefault_picture_company.svg/")
const DefaultUrl = "/static/images/default/default_picture_company.svg"
const imgUrl = (offre.company && offre.company.presentation_video && offre.company.presentation_video.thumbnails && offre.company.presentation_video.thumbnails[0] && offre.company.presentation_video.thumbnails[0].sizes[2]) ? offre.company.presentation_video.thumbnails[0].sizes[2].link : DefaultUrl
const imgUrlDesktop = (offre.company && offre.company.presentation_video && offre.company.presentation_video.thumbnails && offre.company.presentation_video.thumbnails[0] && offre.company.presentation_video.thumbnails[0].sizes[4]) ? offre.company.presentation_video.thumbnails[0].sizes[4].link : DefaultUrl
+1 -2
View File
@@ -124,8 +124,7 @@ class OffreRowComponent extends React.Component {
companyR = company;
const imgUrl = (rowData.video && rowData.video.thumbnails && rowData.video.thumbnails[0] && rowData.video.thumbnails[0].sizes[4]) ? rowData.video.thumbnails[0].sizes[4].link : publicRuntimeConfig.adListDefaultUrl
// const logoUrl =companyR.logo? publicRuntimeConfig.logoRootUrl + companyR.logo:"https://www.talentstube.com/img/default_picture_svg";
//rowData._embedded.company.brand_name
return (
<Link href={`/Offre/${rowData.id}-${_.kebabCase(rowData.title)}-${_.kebabCase(rowData.location.gmap_address.name)}`} >
<Card className={classes.card + ' cypCardOffre'} >
@@ -118,7 +118,6 @@ const videoList = [
{ vimeoId: '350927537', title: 'Fym Action', adTitle: 'Promoteur des ventes en alimentaire (H/F)', link: '/Offre/81-Fym-Action-Caudan' }
]
class ShortVideoHooker extends Component {
constructor(props) {
super(props);
+1 -1
View File
@@ -97,7 +97,7 @@ class Tile extends React.Component {
const imgUrl = (rowData.video) ? imgAdUrl : imgCompanyUrl
const logoName = (rowData.company) ? rowData.company.logo : rowData.logo
const logoUrl = publicRuntimeConfig.logoRootUrl + logoName
const logoUrl = publicRuntimeConfig.symphonyUrl + publicRuntimeConfig.cachedMediaUrl + logoName
const router = (rowData.company) ? `/Offre/${rowData.id}-${_.kebabCase(rowData.title)}-${_.kebabCase(rowData.location.gmap_address.name)}` : `/Entreprise/${rowData.id}-${_.kebabCase(rowData.brand_name)}-${_.kebabCase(rowData.addresses.billing.city)}`
+4 -3
View File
@@ -24,12 +24,12 @@ const styles = theme => ({
fontWeight: '300',
color: theme.palette.primary.dark,
backgroundColor: theme.palette.background.grey,
minWidth: '65vw',
minWidth: '75vw',
padding: 0,
margin: 0,
paddingLeft: theme.spacing(2),
[theme.breakpoints.up('md')]: {
minWidth: '42vw',
minWidth: '85vw',
},
}
},
@@ -149,7 +149,7 @@ class Grid extends Component {
searchSubmit = () => {
const { currentPage, pageSize, promoted, filterText } = this.state;
this.props.dataFetcher({ offset: (currentPage - 1) * pageSize + 1, limit: pageSize, keyword: filterText, ispromoted: promoted });
this.props.dataFetcher({ offset: 1, limit: pageSize, keyword: filterText, ispromoted: promoted });
}
render() {
@@ -256,6 +256,7 @@ class Grid extends Component {
this.searchSubmit()
}
}}
type="search"
/>
<Button onClick={this.searchSubmit}
disabled={loading}
@@ -4,7 +4,6 @@ describe('RegisterTest', function() {
before(function(){
cy.exec('yarn dropAndCreateDB',{failOnNonZeroExit: false});
cy.exec('yarn add cypress',{failOnNonZeroExit: false});
})
it('Test if Register works', function() {
cy.viewport(375, 667)
+9 -1
View File
@@ -54,7 +54,15 @@ export default {
},
isUserSubscribedToPush: (id) => {
return axios.get(`/api/isUserSubscribedPush/${id}`).then(res => res)
}
},
uploadPicture: (payload) => {
return axios.post("/api/update_profile_picture", payload, {
headers: {
'Content-Type': `multipart/form-data;`
},
withCredentials: true
}).then(res => res)
},
},
ads: {
fetchAd: (id) => {
+40 -37
View File
@@ -8,43 +8,47 @@ const Dotenv = require('dotenv-webpack');
const { ANALYZE, DEV } = process.env
module.exports = withPlugins([
[withCSS],
[optimizedImages, {
/* config for next-optimized-images */
}],
[withOffline, {
dontAutoRegisterSw: DEV ? true : false,
workboxOpts: {
module.exports = withPlugins(
[
[withCSS],
[optimizedImages, {
/* config for next-optimized-images */
}],
[withOffline, {
dontAutoRegisterSw: DEV ? true : false,
workboxOpts: {
runtimeCaching: [
// { urlPattern: /.*auth.*/, handler: 'networkOnly' },
// { urlPattern: /.*account.*/, handler: 'networkOnly' },
{ urlPattern: /^https?.*/, handler: 'NetworkFirst' },
{ urlPattern: /\.(?:png|jpg|jpeg|svg|webp)$/,
handler: "CacheFirst",
options: {
cacheName: "images",
expiration: {
maxEntries: 100
}
}}
// { urlPattern: /.*auth.*/, handler: 'networkOnly' },
// { urlPattern: /.*account.*/, handler: 'networkOnly' },
{ urlPattern: /^https?.*/, handler: 'NetworkFirst' },
{
urlPattern: /\.(?:png|jpg|jpeg|svg|webp)$/,
handler: "CacheFirst",
options: {
cacheName: "images",
expiration: {
maxEntries: 100
}
}
}
],
importScripts:
['/static/js/Edeclic-service-worker.js',
'/static/js/backgroundSync-sw.js'
]
},
}],
[{
publicRuntimeConfig: {
frontServerUrl: 'https://pp.app.talentstube.com',
enableVideo: true,
adListDefaultUrl: "/static/images/default/default_picture_company.svg",
logoRootUrl: 'https://www.talentstube.com/media/cache/profile_thumb/uploads/img/'
}
}]],
['/static/js/Edeclic-service-worker.js',
'/static/js/backgroundSync-sw.js'
]
},
}],
[{
publicRuntimeConfig: {
symphonyUrl: 'https://www.talentstube.com',
frontServerUrl: 'https://pp.app.talentstube.com',
enableVideo: true,
adListDefaultUrl: "/static/images/default/default_picture_company.svg",
cachedMediaUrl: '/media/cache/profile_thumb/uploads/img/',
postedContentUrl: '/uploads/img/',
}
}]
],
{
webpack: (config, { isServer }) => {
@@ -68,13 +72,12 @@ module.exports = withPlugins([
RecordRTC: "recordrtc"
};
config.resolve.alias = { ...config.resolve.alias, ...videojsAlias };
config.plugins.push(videojsPlugin);
config.plugins.push(new Dotenv());
console.info(config);
// console.info(config);
return config
}
},
+2 -2
View File
@@ -14,10 +14,10 @@
<lastmod>2019-09-17</lastmod>
</url>,<url>
<loc>https://app.talentstube.com/Help</loc>
<lastmod>2019-09-17</lastmod>
<lastmod>2019-10-07</lastmod>
</url>,<url>
<loc>https://app.talentstube.com/Login</loc>
<lastmod>2019-09-17</lastmod>
<lastmod>2019-10-09</lastmod>
</url>,<url>
<loc>https://app.talentstube.com/MentionsLegales</loc>
<lastmod>2019-09-17</lastmod>
+20 -13
View File
@@ -1,4 +1,4 @@
import React, { Component } from 'react'
import React, { Component, Fragment } from 'react'
import Router from 'next/router'
import { connect } from "react-redux";
import { withStyles } from '@material-ui/core/styles';
@@ -6,28 +6,29 @@ import setAuthorizationHeader from "../data/setAuthorizationHeader";
import Loader from './../components/templates/loader'
import { userLoggedIn, requestLoginFailure } from "../actions/auth";
import Head from 'next/head'
const styles = theme => ({
container: {
display: 'flex',
flexDirection: 'column',
height: '100%',
},
});
class AuthRouter extends Component {
componentDidMount()
{
componentDidMount() {
let JWT = this.props.JWT;
if( JWT === null){
if (JWT === null) {
//free token
setAuthorizationHeader()
localStorage.setItem('ttJWT','')
localStorage.setItem('ttJWT', '')
this.props.requestLoginFailure('JWT absent')
Router.push('/Login');}
else
{
Router.push('/Login');
}
else {
localStorage.setItem('ttJWT', JWT)
//set token to axios headers
setAuthorizationHeader(JWT)
@@ -38,25 +39,31 @@ class AuthRouter extends Component {
this.props.userLoggedIn()
}
}
render() {
return (
<Fragment>
<Head>
<title key="title">OAuth authentification router</title>
<meta key="robots" name="robots" content="noindex, nofollow"></meta>
</Head>
<div>
<Loader />
</div>
</Fragment>
)
}
}
AuthRouter.getInitialProps = function (context) {
const { JWT } = context.query
return {JWT:JWT};
return { JWT: JWT };
}
export default withStyles(styles)(connect(null, {userLoggedIn, requestLoginFailure})(AuthRouter));
export default withStyles(styles)(connect(null, { userLoggedIn, requestLoginFailure })(AuthRouter));
+1
View File
@@ -72,6 +72,7 @@ class ConfirmAccount extends Component {
<LayoutBack text="Validation" height="fixed">
<Head>
<title key="title">Confirmation de compte</title>
<meta key="robots" name="robots" content="noindex, nofollow"></meta>
</Head>
<div className={classes.container}>
{loading && (
+1 -1
View File
@@ -357,7 +357,7 @@ class Entreprise extends React.Component {
render() {
const { classes, company } = this.props;
const logoUrl = (company.logo ? publicRuntimeConfig.logoRootUrl + company.logo : "https://www.talentstube.com/img/default_picture_svg")
const logoUrl = (company.logo ? publicRuntimeConfig.symphonyUrl + publicRuntimeConfig.cachedMediaUrl + company.logo : "https://www.talentstube.com/img/default_picture_svg")
const DefaultUrl = "https://www.talentstube.com/img/default_picture_svg"
const imgUrl = (company.presentation_video && company.presentation_video.thumbnails[0] && company.presentation_video.thumbnails[0].sizes[2]) ? company.presentation_video.thumbnails[0].sizes[2].link : DefaultUrl
+4
View File
@@ -16,6 +16,10 @@ import { payloadFromSubscription } from '../components/atoms/Utility';
//import { subscribeUserToPushRequest } from '../actions/user'
import Head from 'next/head'
///
/// ! Push notification needs the service worker to be used
///
const styles = theme => ({
container: {
display: 'flex',
+3 -2
View File
@@ -282,8 +282,8 @@ class Reponse extends React.Component {
render() {
const { loading, activeStep } = this.state;
const { classes, menu, offre, company } = this.props;
const logoUrl = (offre.company ? publicRuntimeConfig.logoRootUrl + offre.company.logo : '');
const logoCompanyUrl = ((company && company.logo) ? publicRuntimeConfig.logoRootUrl + company.logo : '');
const logoUrl = (offre.company ? publicRuntimeConfig.symphonyUrl + publicRuntimeConfig.cachedMediaUrl + offre.company.logo : '');
const logoCompanyUrl = ((company && company.logo) ? publicRuntimeConfig.symphonyUrl + publicRuntimeConfig.cachedMediaUrl + company.logo : '');
let rootStepper = activeStep === 0 ? (
classes.rootStepperDefault
@@ -295,6 +295,7 @@ class Reponse extends React.Component {
<Head>
<title>Candidature vidéo</title>
<meta name="description" content="Talent's tube, postulez en video." />
<meta key="robots" name="robots" content="noindex, nofollow"></meta>
<link rel="canonical" href="https://app.talentstube.com" />
</Head>
{/* https://codesandbox.io/s/ii0us */}
+8 -9
View File
@@ -12,7 +12,7 @@ const styles = theme => ({
flexDirection: 'column',
position: 'relative',
height: '100%',
padding: theme.spacing(1,3),
padding: theme.spacing(1, 3),
},
bottomContainer: {
display: 'flex',
@@ -56,19 +56,18 @@ const styles = theme => ({
class VerifyEmail extends Component {
render() {
const { classes, email } = this.props;
console.log("render")
console.log(this.props)
return (
<Layout text="Inscription" height="fixed">
<Head>
<title key="title">Vérification d'email</title>
</Head>
<Head>
<title key="title">Vérification d'email</title>
<meta key="robots" name="robots" content="noindex, nofollow"></meta>
</Head>
<div className={classes.container}>
<Typography gutterBottom align="center" className={classes.title}>
Consultez vos e-mails
</Typography>
<Typography gutterBottom align="left" className={classes.text}>
Un e-mail a été envoyé à l'adresse <span className={ classes.email }>{email}</span>
Un e-mail a été envoyé à l'adresse <span className={classes.email}>{email}</span>
</Typography>
<Typography gutterBottom align="left" className={classes.text}>
Cliquez sur le lien dans l'e-mail que nous vous avons envoyé pour activer votre compte.
@@ -93,10 +92,10 @@ console.log(this.props)
}
VerifyEmail.getInitialProps = async function (context) {
const {email} = context.query;
const { email } = context.query;
console.log("email")
console.log(email)
return {email}
return { email }
}
export default withStyles(styles)(VerifyEmail)
+1 -1
View File
@@ -18,7 +18,7 @@ class Error extends React.Component {
<p>
{this.props.statusCode
? `Une erreur ${this.props.statusCode} est survenue sur le serveur.`
: 'Une erreur est survenue sur le client'}
: 'Une erreur est survenue dans l\'application.'}
</p>
</LayoutBack>
+25 -1
View File
@@ -25,7 +25,11 @@ import {
RESET_PASSWORD_FAILURE,
SUBSCRIBE_USER_TO_PUSH_REQUEST,
SUBSCRIBE_USER_TO_PUSH_SUCCESS,
SUBSCRIBE_USER_TO_PUSH_FAILURE
SUBSCRIBE_USER_TO_PUSH_FAILURE,
UPDATE_USER_PICTURE_REQUEST,
UPDATE_USER_PICTURE_SUCCESS,
UPDATE_USER_PICTURE_FAILURE,
} from "../types";
export function user(state = {
@@ -77,6 +81,23 @@ export function user(state = {
fetched: false,
}
case UPDATE_USER_PICTURE_REQUEST:
return {
...state,
pictureLoading: true,
}
case UPDATE_USER_PICTURE_SUCCESS:
return {
...state,
pictureLoading: false,
picture: action.data.file
}
case UPDATE_USER_PICTURE_FAILURE:
return {
...state,
pictureLoading: false,
}
case REQUEST_REGISTER:
return {
loading: true,
@@ -150,15 +171,18 @@ export function user(state = {
}
case SUBSCRIBE_USER_TO_PUSH_REQUEST:
return {
...state,
loading: true,
}
case SUBSCRIBE_USER_TO_PUSH_SUCCESS:
return {
...state,
loading: false,
pushSubscribed: true
}
case SUBSCRIBE_USER_TO_PUSH_FAILURE:
return {
...state,
loading: false,
pushSubscribed: false,
errors: action.err,
+12 -5
View File
@@ -2,11 +2,16 @@
import { all, call, delay, put, take, takeLatest } from 'redux-saga/effects'
import es6promise from 'es6-promise'
import { requestSubscribeUserToPushSaga, requestResetPasswordSaga, verifyUserSaga, requestUpdateUserSaga, requestConfirmationAccountSaga, sendConfirmationEmailSaga, requestLoginSaga, requestUserSaga, requestRegisterSaga, requestLogoutSaga, requestNewsletterSubscribitionSaga, requestIsUserSubscribedToPush } from './sagas/userSaga.js'
import {
requestSubscribeUserToPushSaga, requestResetPasswordSaga,
verifyUserSaga, requestUpdateUserSaga, requestConfirmationAccountSaga,
sendConfirmationEmailSaga, requestLoginSaga, requestUserSaga,
requestRegisterSaga, requestLogoutSaga, requestNewsletterSubscribitionSaga,
requestUpdateUserRequestSaga, requestIsUserSubscribedToPushSaga
} from './sagas/userSaga.js'
import { requestAdsSaga, requestAdSaga, requestEmphasisAdsSaga, countAdViewRequestSaga } from './sagas/offreSaga.js'
import { requestCompaniesSaga, requestCompanySaga, requestEmphasisCompaniesSaga, countCompanyViewRequestSaga } from './sagas/companySaga.js'
import { postAnswerMessageSaga, postAdAnswerRequestSaga, uploadMediaSaga, fetchAdsAnsweredRequestSaga, fetchAnswerRequestSaga ,fetchAnswerMessagesRequestSaga} from './sagas/answerSaga.js'
import { postAnswerMessageSaga, postAdAnswerRequestSaga, uploadMediaSaga, fetchAdsAnsweredRequestSaga, fetchAnswerRequestSaga, fetchAnswerMessagesRequestSaga } from './sagas/answerSaga.js'
import {
REQUEST_LOGIN,
@@ -35,6 +40,7 @@ import {
COUNT_AD_VIEW,
COUNT_COMPANY_VIEW,
IS_USER_SUBSCRIBED_TO_PUSH_REQUEST,
UPDATE_USER_PICTURE_REQUEST
} from "./types";
@@ -65,10 +71,11 @@ function* rootSaga() {
takeLatest(RESET_PASSWORD_REQUEST, requestResetPasswordSaga),
takeLatest(SUBSCRIBE_USER_TO_PUSH_REQUEST, requestSubscribeUserToPushSaga),
takeLatest(POST_MESSAGE_ANSWER_REQUEST, postAnswerMessageSaga),
takeLatest(FETCH_ANSWER_MESAGES_REQUEST, fetchAnswerMessagesRequestSaga ),
takeLatest(FETCH_ANSWER_MESAGES_REQUEST, fetchAnswerMessagesRequestSaga),
takeLatest(COUNT_AD_VIEW, countAdViewRequestSaga),
takeLatest(COUNT_COMPANY_VIEW, countCompanyViewRequestSaga),
takeLatest(IS_USER_SUBSCRIBED_TO_PUSH_REQUEST, requestIsUserSubscribedToPushSaga)
takeLatest(IS_USER_SUBSCRIBED_TO_PUSH_REQUEST, requestIsUserSubscribedToPushSaga),
takeLatest(UPDATE_USER_PICTURE_REQUEST, requestUpdateUserRequestSaga)
])
}
+24 -1
View File
@@ -11,7 +11,8 @@ import {
updateUserRequestSuccess, updateUserRequestFailure,
resetPasswordSuccess, resetPasswordFailure,
subscribeUserToPushSuccess, subscribeUserToPushFailure,
isUserSubscribedToPushSuccess, isUserSubscribedToPushFailure
isUserSubscribedToPushSuccess, isUserSubscribedToPushFailure,
updateUserPictureSuccess, updateUserPictureFailure
} from "../actions/user";
import setAuthorizationHeader from "../data/setAuthorizationHeader";
@@ -95,6 +96,7 @@ export function* verifyUserSaga(action) {
Router.push(`/Login`);
}
}
///
///{
// type: 'SUBSCRIBE_NEWSLETTER_REQUEST',
@@ -243,4 +245,25 @@ export function* requestIsUserSubscribedToPushSaga(action) {
console.error(err.message)
yield put(isUserSubscribedToPushFailure({ err: err, message: err.message }));
}
}
export function* requestUpdateUserRequestSaga(action) {
try {
const res = yield call(api.user.uploadPicture, action.payload);
console.log(res);
if (!!res.data)
yield put(updateUserPictureSuccess(res.data));
else
yield put(updateUserPictureFailure());
} catch (err) {
console.log(err);
if (_.includes(err, "401") || (!!err.response && err.response.status === 401)) {
localStorage.setItem('loginRedirect', window.location)
Router.push("/Login");
}
yield put(updateUserPictureFailure(err.response));
}
}
+1 -2
View File
@@ -91,8 +91,7 @@
const windowClient = windowClients[i];
if (windowClient.focused) {
console.info('Posting message to page');
windowClient.postMessage(event.data.json().notification
);
windowClient.postMessage(event.data.json().notification);
}
}
});
+3
View File
@@ -48,6 +48,9 @@ export const SUBSCRIBE_USER_TO_PUSH_FAILURE = "SUBSCRIBE_USER_TO_PUSH_FAILURE"
export const IS_USER_SUBSCRIBED_TO_PUSH_REQUEST = "IS_USER_SUBSCRIBED_TO_PUSH_REQUEST"
export const IS_USER_SUBSCRIBED_TO_PUSH_SUCCESS = "IS_USER_SUBSCRIBED_TO_PUSH_SUCCESS"
export const IS_USER_SUBSCRIBED_TO_PUSH_FAILURE = "IS_USER_SUBSCRIBED_TO_PUSH_FAILURE"
export const UPDATE_USER_PICTURE_REQUEST = "UPDATE_USER_PICTURE_REQUEST"
export const UPDATE_USER_PICTURE_SUCCESS = "UPDATE_USER_PICTURE_SUCCESS"
export const UPDATE_USER_PICTURE_FAILURE = "UPDATE_USER_PICTURE_FAILURE"
//ANSWER
export const POST_AD_ANSWER_REQUEST = "POST_AD_ANSWER_REQUEST";
+17 -1
View File
@@ -9011,7 +9011,7 @@ prop-types-exact@1.2.0:
object.assign "^4.1.0"
reflect.ownkeys "^0.2.0"
prop-types@15.7.2, prop-types@^15.5.4, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2, prop-types@latest:
prop-types@15.7.2, prop-types@^15.5.0, prop-types@^15.5.4, prop-types@^15.5.8, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2, prop-types@latest:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
@@ -9231,6 +9231,14 @@ rc@^1.1.2, rc@^1.2.7:
minimist "^1.2.0"
strip-json-comments "~2.0.1"
react-async-script@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/react-async-script/-/react-async-script-1.1.1.tgz#f481c6c5f094bf4b94a9d52da0d0dda2e1a74bdf"
integrity sha512-pmgS3O7JcX4YtH/Xy//NXylpD5CNb5T4/zqlVUV3HvcuyOanatvuveYoxl3X30ZSq/+q/+mSXcNS8xDVQJpSeA==
dependencies:
hoist-non-react-statics "^3.3.0"
prop-types "^15.5.0"
react-dom@^16.9.0:
version "16.9.0"
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.9.0.tgz#5e65527a5e26f22ae3701131bcccaee9fb0d3962"
@@ -9260,6 +9268,14 @@ react-ga@^2.5.7:
resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-2.6.0.tgz#c3fe830ead2ad25117e1d33280d9698de9b28496"
integrity sha512-GWHBWZDFjDGMkIk1LzroIn0mNTygKw3adXuqvGvheFZvlbpqMPbHsQsTdQBIxRRdXGQM/Zq+dQLRPKbwIHMTaw==
react-google-recaptcha@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/react-google-recaptcha/-/react-google-recaptcha-2.0.1.tgz#3276b29659493f7ca2a5b7739f6c239293cdf1d8"
integrity sha512-4Y8awVnarn7+gdVpu8uvSmRJzzlMMoXqdhLoyToTOfVK6oM+NaChNI8NShnu75Q2YGHLvR1IA1FWZesuYHwn5w==
dependencies:
prop-types "^15.5.0"
react-async-script "^1.1.1"
react-is@16.8.6:
version "16.8.6"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16"