Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1276a73c21 | |||
| 68e5abb088 | |||
| b52f05002b | |||
| e1bb5de959 |
+1
-17
@@ -5,9 +5,6 @@ import {
|
||||
UPLOAD_MEDIA_PRES_REQUEST,
|
||||
UPLOAD_MEDIA_PRES_FAILURE,
|
||||
UPLOAD_MEDIA_PRES_SUCCESS,
|
||||
UPLOAD_MEDIA_CV_REQUEST,
|
||||
UPLOAD_MEDIA_CV_FAILURE,
|
||||
UPLOAD_MEDIA_CV_SUCCESS,
|
||||
|
||||
} from "../types";
|
||||
|
||||
@@ -41,19 +38,6 @@ import {
|
||||
res
|
||||
});
|
||||
|
||||
export const uploadMediaCv = payload => ({
|
||||
type: UPLOAD_MEDIA_CV_REQUEST,
|
||||
payload
|
||||
});
|
||||
|
||||
export const uploadMediaCvFailure = errors => ({
|
||||
type: UPLOAD_MEDIA_CV_FAILURE,
|
||||
errors
|
||||
});
|
||||
|
||||
export const uploadMediaCvSuccess = res => ({
|
||||
type: UPLOAD_MEDIA_CV_SUCCESS,
|
||||
res
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import {
|
||||
UPLOAD_MEDIA_CV_REQUEST,
|
||||
UPLOAD_MEDIA_CV_FAILURE,
|
||||
UPLOAD_MEDIA_CV_SUCCESS,
|
||||
|
||||
} from "../types";
|
||||
|
||||
|
||||
|
||||
export const uploadMediaCv = payload => ({
|
||||
type: UPLOAD_MEDIA_CV_REQUEST,
|
||||
payload
|
||||
});
|
||||
|
||||
export const uploadMediaCvFailure = errors => ({
|
||||
type: UPLOAD_MEDIA_CV_FAILURE,
|
||||
errors
|
||||
});
|
||||
|
||||
export const uploadMediaCvSuccess = res => ({
|
||||
type: UPLOAD_MEDIA_CV_SUCCESS,
|
||||
res
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import React, { Fragment } from 'react';
|
||||
import { connect } from "react-redux";
|
||||
import { fetchCurrentUserRequest } from '../../actions/user'
|
||||
import { fetchCompanyRequest } from '../../actions/companies'
|
||||
import { uploadMediaCv } from '../../actions/media'
|
||||
import { uploadMediaCv } from '../../actions/mediaCv'
|
||||
import { withStyles } from '@material-ui/core/styles'
|
||||
import { makeStyles } from '@material-ui/styles';
|
||||
import { Button, Typography, Divider, Hidden } from '@material-ui/core';
|
||||
@@ -246,7 +246,7 @@ function mapStateToProps(state) {
|
||||
// console.log(state.media.message)
|
||||
return {
|
||||
user: state.user ,
|
||||
cvLink : state.media.message,
|
||||
cvLink : state.mediaCv.message,
|
||||
loading: !!state.media.loading,
|
||||
cv : true,
|
||||
//errors: errorMessageSelector(state),
|
||||
|
||||
@@ -21,7 +21,7 @@ import DialogActions from '@material-ui/core/DialogActions';
|
||||
import DialogContent from '@material-ui/core/DialogContent';
|
||||
import DialogContentText from '@material-ui/core/DialogContentText';
|
||||
import DialogTitle from '@material-ui/core/DialogTitle';
|
||||
import { uploadMediaCv } from '../../actions/media'
|
||||
import { uploadMediaCv } from '../../actions/mediaCv'
|
||||
import GetApp from '@material-ui/icons/GetApp';
|
||||
// import PlacesAutocomplete from 'react-places-autocomplete';
|
||||
// import {
|
||||
@@ -181,13 +181,13 @@ class Answer extends Component {
|
||||
|
||||
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||
this.setState({
|
||||
firstname: nextProps.user.firstname,
|
||||
lastname: nextProps.user.lastname,
|
||||
phone: nextProps.user.phone,
|
||||
currentJob: nextProps.user.currentJob,
|
||||
linkedin: nextProps.user.linkedin,
|
||||
twitter: nextProps.user.twitter,
|
||||
website: nextProps.user.website,
|
||||
firstname: this.state.firstname,
|
||||
lastname: this.state.lastname,
|
||||
phone: this.state.phone,
|
||||
currentJob: this.state.currentJob,
|
||||
linkedin: this.state.linkedin,
|
||||
twitter: this.state.twitter,
|
||||
website: this.state.website,
|
||||
mediaId: nextProps.mediaId,
|
||||
mediaUrl: nextProps.mediaUrl,
|
||||
thumbnails: nextProps.thumbnails,
|
||||
@@ -222,7 +222,7 @@ class Answer extends Component {
|
||||
thumbnails : this.props.thumbnails,
|
||||
heure : this.props.heure,
|
||||
loading: false,
|
||||
cvLink: this.props.cvLink instanceof Object ? this.props.user.cv : this.props.cvLink
|
||||
cvLink: this.props.user.cv
|
||||
|
||||
})
|
||||
}
|
||||
@@ -643,11 +643,12 @@ function mapStateToProps(state, ownProps) {
|
||||
// console.log(state.media.message.heure);
|
||||
return {
|
||||
user: state.user ,
|
||||
cvLink : state.media.message,
|
||||
cvLink : state.mediaCv.message,
|
||||
loading: !!state.media.loading,
|
||||
cv : true,
|
||||
user: state.user,
|
||||
// loading: !!state.user.loading,
|
||||
phone:ownProps.phone,
|
||||
pictureLoading: !!state.user.pictureLoading,
|
||||
errors: state.user.errors || ownProps.errors,
|
||||
mediaId: state.media.message && state.media.message.mediaId,
|
||||
|
||||
@@ -129,6 +129,9 @@ export default {
|
||||
withCredentials: true
|
||||
}).then(res => res)
|
||||
},
|
||||
|
||||
},
|
||||
cv:{
|
||||
uploadMediaCv: (payload) => {
|
||||
return axios.post("/api/mediaCv", payload, {
|
||||
headers: {
|
||||
|
||||
@@ -55,7 +55,7 @@ module.exports = withPlugins(
|
||||
blogUrl: 'https://blog.talentstube.com',
|
||||
frontServerUrl: 'https://pp.app.talentstube.com/',
|
||||
cvThequeUrl: 'https://recruteur.talentstube.com',
|
||||
version : 'V2.4.2',
|
||||
version : 'V2.4.3',
|
||||
adListDefaultUrl: '/statique/images/default/default_picture_company.svg',
|
||||
cachedMediaUrl: '/media/cache/profile_thumb/uploads/img/',
|
||||
postedContentUrl: '/uploads/img/',
|
||||
|
||||
@@ -5,9 +5,6 @@ import {
|
||||
UPLOAD_MEDIA_PRES_REQUEST,
|
||||
UPLOAD_MEDIA_PRES_FAILURE,
|
||||
UPLOAD_MEDIA_PRES_SUCCESS,
|
||||
UPLOAD_MEDIA_CV_REQUEST,
|
||||
UPLOAD_MEDIA_CV_FAILURE,
|
||||
UPLOAD_MEDIA_CV_SUCCESS,
|
||||
} from "../types";
|
||||
|
||||
export function media(state = {
|
||||
@@ -47,23 +44,7 @@ export function media(state = {
|
||||
errors: action.errors,
|
||||
loading: false
|
||||
};
|
||||
case UPLOAD_MEDIA_CV_REQUEST:
|
||||
return {
|
||||
...state,
|
||||
loading: true
|
||||
};
|
||||
case UPLOAD_MEDIA_CV_SUCCESS:
|
||||
return {
|
||||
...state,
|
||||
...action.res.data,
|
||||
loading: false
|
||||
};
|
||||
case UPLOAD_MEDIA_CV_FAILURE:
|
||||
return {
|
||||
...state,
|
||||
errors: action.errors,
|
||||
loading: false
|
||||
};
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import {
|
||||
UPLOAD_MEDIA_CV_REQUEST,
|
||||
UPLOAD_MEDIA_CV_FAILURE,
|
||||
UPLOAD_MEDIA_CV_SUCCESS,
|
||||
} from "../types";
|
||||
|
||||
export function mediaCv(state = {
|
||||
}, action = {}) {
|
||||
switch (action.type) {
|
||||
case UPLOAD_MEDIA_CV_REQUEST:
|
||||
return {
|
||||
...state,
|
||||
loading: true
|
||||
};
|
||||
case UPLOAD_MEDIA_CV_SUCCESS:
|
||||
return {
|
||||
...state,
|
||||
...action.res.data,
|
||||
loading: false
|
||||
};
|
||||
case UPLOAD_MEDIA_CV_FAILURE:
|
||||
return {
|
||||
...state,
|
||||
errors: action.errors,
|
||||
loading: false
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
export const mediaCvErrorsSelector = state => {return !!state.mediaCv.errors ?state.mediaCv.errors.response.data:null};
|
||||
|
||||
export const errorMessageSelector = (state) => {
|
||||
let err = mediaCvErrorsSelector(state)
|
||||
if (!!!err)
|
||||
return null;
|
||||
switch(err.code)
|
||||
{
|
||||
case 500:
|
||||
return {message: "Le téléversement de votre video à échoué."}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import { emphasisCompanies } from "./reducers/emphasisCompanies";
|
||||
import { answer } from "./reducers/answer";
|
||||
import { answers } from "./reducers/answers";
|
||||
import { media } from "./reducers/media";
|
||||
import { mediaCv } from "./reducers/mediaCv";
|
||||
|
||||
export const exampleInitialState = {
|
||||
user: {
|
||||
@@ -41,6 +42,9 @@ export const exampleInitialState = {
|
||||
},
|
||||
media:{
|
||||
|
||||
},
|
||||
mediaCv:{
|
||||
|
||||
},
|
||||
answers:{
|
||||
data: {}
|
||||
@@ -57,5 +61,6 @@ export default combineReducers({
|
||||
emphasisCompanies,
|
||||
answer,
|
||||
media,
|
||||
mediaCv,
|
||||
answers
|
||||
});
|
||||
|
||||
@@ -26,9 +26,13 @@ import {
|
||||
uploadMediaFailure,
|
||||
uploadMediaPresSuccess,
|
||||
uploadMediaPresFailure,
|
||||
|
||||
} from "../actions/media";
|
||||
|
||||
import {
|
||||
uploadMediaCvSuccess,
|
||||
uploadMediaCvFailure
|
||||
} from "../actions/media";
|
||||
} from "../actions/mediaCv";
|
||||
import AuthRouter from "../pages/AuthRouter";
|
||||
|
||||
export function* postAdAnswerRequestSaga(action) {
|
||||
@@ -101,7 +105,7 @@ export function* uploadMediaPresSaga(action) {
|
||||
export function* uploadMediaCvSaga(action) {
|
||||
try {
|
||||
|
||||
const res = yield call(api.medias.uploadMediaCv, action.payload);
|
||||
const res = yield call(api.cv.uploadMediaCv, action.payload);
|
||||
|
||||
if (!!res.data)
|
||||
yield put(uploadMediaCvSuccess(res));
|
||||
|
||||
Reference in New Issue
Block a user