// The CRUD Operations of the Todo Resource. //Create const createTodo = todo => { return HttpClient.post(TODO_API, todo) }
// Signin User function* _handleSignin(action) { const { user } = action; try { const response = yield Instance.post('/auth/login', user); yield put(_signinSuccessAction(response.data)); yield setAuthToken(response.data.token); yield put(push('/')); } catch (err) { yield put(_signinFailedAction(err.response.data)); } }
const registerAction = values => { return dispatch => { dispatch({ type: types.REGISTER.REGISTER_START }); dataService .post('/api/auth/signup', values) .then(res => { dispatch({ type: types.REGISTER.REGISTER_SUCCESS }); history.push('/login'); }) .catch(error => { dispatch({ type: types.REGISTER.REGISTER_ERROR, data: error.response.data[0] }); }); }; }
axios.post("https://fast-escarpment-67919.herokuapp.com/techniques/create", { id: this.state.id, name: this.state.name, description: this.state.description, type: this.state.type }).then((res) => { if (res.data.success === true) { this.setRedirect(); } else { this.setState({ message: res.data.error, visible: true, }); } }).catch((err) => { console.log(err) this.setState({ message: 'Error conecting to servers', visible: true, }); });
axios.post("https://fast-escarpment-67919.herokuapp.com/evaluations/create", { userId: fire.auth().currentUser.uid, userEmail: fire.auth().currentUser.email, technologyId: this.state.technology.id, techniqueId: this.state.technique.id, technologyName: this.state.technology.name, techniqueName: this.state.technique.name, codesnippet: this.state.codesnippet, youtubeurl: this.state.youtubeurl, textEvaluation: this.state.textEvaluation, numericalEvaluation: this.state.numericalEvaluation, githubUrl: this.state.githubUrl }).then((res) => { if (res.data.success === true) { this.setRedirect(); } else { this.setState({ message: res.data.error, visible: true, }); } }).catch((err) => { console.log(err) this.setState({ message: 'Error conecting to servers', visible: true, }); });
// Register User function* __handleRegisterUser(action) { const { user } = action; try { const response = yield Instance.post('/auth/register', user); yield put(_registerUserSuccessAction(response.data)); } catch (err) { yield put(_registerUserFailedAction(err.response.data)); } }
const loginAction = (usernameOrEmail, password) => { return dispatch => { dispatch({ type: types.LOGIN.LOGIN_START }); dataService .post('/api/auth/signin', { usernameOrEmail: usernameOrEmail, password: password }) .then(res => { localStorage.setItem('auth_token', res.data); dispatch({ type: types.LOGIN.LOGIN_SUCCESS, data: decode(res.data) }); history.push('/'); }) .catch(error => { dispatch({ type: types.LOGIN.LOGIN_ERROR, data: error.response.data[0] }); }); }; }
const likeItem = (item) => { return backendApi.post(`/videos`, { method: "POST", params: { videoId: item.id.videoId, userId: 1, }, }); }
axios.post("https://fast-escarpment-67919.herokuapp.com/evaluations/create-new", { userId: fire.auth().currentUser.uid, userEmail: fire.auth().currentUser.email, id: evaluation.id, codesnippet: this.state.codesnippet, youtubeurl: this.state.youtubeurl, textEvaluation: this.state.textEvaluation, numericalEvaluation: this.state.numericalEvaluation, githubUrl: this.state.githubUrl, }).then((res) => { if (res.data.success === true) { this.setRedirect(); } else { this.setState({ message: res.data.error, visible: true, }); } }).catch((err) => { console.log(err) this.setState({ message: 'Error conecting to servers', visible: true, }); });
axios.post("https://fast-escarpment-67919.herokuapp.com/technologies/create", { id: this.state.id, name: this.state.name, creator: this.state.creator, description: this.state.description, url: this.state.url, imageurl: this.state.imageurl }).then((res) => { if (res.data.success === true) { this.setRedirect(); } else { this.setState({ message: res.data.error, visible: true, }); } }).catch((err) => { console.log(err) this.setState({ message: 'Error conecting to servers', visible: true, }); });
axios.post("https://fast-escarpment-67919.herokuapp.com/technologies/create", { id: this.state.id, name: this.state.name, creator: this.state.creator, description: this.state.description, url: this.state.url, imageurl: this.state.imageurl }).then((res) => { if (res.data.success === true) { this.setRedirect(); } else { this.setState({ message: res.data.error, visible: true, }); } }).catch((err) => { console.log(err) this.setState({ message: 'Error conecting to servers', visible: true, }); });
axios.post("https://fast-escarpment-67919.herokuapp.com/techniques/create", { id: this.state.id, name: this.state.name, description: this.state.description, type: this.state.type }).then((res) => { if (res.data.success === true) { this.setRedirect(); } else { this.setState({ message: res.data.error, visible: true, }); } }).catch((err) => { console.log(err) this.setState({ message: 'Error conecting to servers', visible: true, }); });
axios.post("https://fast-escarpment-67919.herokuapp.com/evaluations/create-new", { userId: fire.auth().currentUser.uid, userEmail: fire.auth().currentUser.email, id: evaluation.id, codesnippet: this.state.codesnippet, youtubeurl: this.state.youtubeurl, textEvaluation: this.state.textEvaluation, numericalEvaluation: this.state.numericalEvaluation, githubUrl: this.state.githubUrl, }).then((res) => { if (res.data.success === true) { this.setRedirect(); } else { this.setState({ message: res.data.error, visible: true, }); } }).catch((err) => { console.log(err) this.setState({ message: 'Error conecting to servers', visible: true, }); });
axios.post("https://fast-escarpment-67919.herokuapp.com/evaluations/create", { userId: fire.auth().currentUser.uid, userEmail: fire.auth().currentUser.email, technologyId: this.state.technology.id, techniqueId: this.state.technique.id, technologyName: this.state.technology.name, techniqueName: this.state.technique.name, codesnippet: this.state.codesnippet, youtubeurl: this.state.youtubeurl, textEvaluation: this.state.textEvaluation, numericalEvaluation: this.state.numericalEvaluation, githubUrl: this.state.githubUrl }).then((res) => { if (res.data.success === true) { this.setRedirect(); } else { this.setState({ message: res.data.error, visible: true, }); } }).catch((err) => { console.log(err) this.setState({ message: 'Error conecting to servers', visible: true, }); });