diff --git a/mpwo_client/src/actions/index.js b/mpwo_client/src/actions/index.js index 4ef0424a..ea4e9d0a 100644 --- a/mpwo_client/src/actions/index.js +++ b/mpwo_client/src/actions/index.js @@ -1,4 +1,4 @@ -import mpwoApi from '../mpwoApi' +import mpwoApiUser from '../mwpoApi/user' import { history } from '../index' import { generateIds } from '../utils' @@ -48,7 +48,7 @@ export const updateProfileFormData = (target, value) => ({ }) export function getProfile(dispatch) { - return mpwoApi + return mpwoApiUser .getProfile() .then(ret => { if (ret.status === 'success') { @@ -64,7 +64,7 @@ export function getProfile(dispatch) { export function register(formData) { return function(dispatch) { - return mpwoApi + return mpwoApiUser .register( formData.username, formData.email, @@ -86,7 +86,7 @@ export function register(formData) { export function login(formData) { return function(dispatch) { - return mpwoApi + return mpwoApiUser .login(formData.email, formData.password) .then(ret => { if (ret.status === 'success') { @@ -165,7 +165,7 @@ export function handleProfileFormSubmit(event) { 'Password and password confirmation don\'t match.' )) } else { - return mpwoApi + return mpwoApiUser .updateProfile(state.formProfile.formProfile) .then(ret => { if (ret.status === 'success') { @@ -189,7 +189,7 @@ export function uploadPicture (event) { form.append('file', event.target.picture.files[0]) event.target.reset() return function(dispatch) { - return mpwoApi + return mpwoApiUser .updatePicture(form) .then(ret => { if (ret.status === 'success') { @@ -206,7 +206,7 @@ export function uploadPicture (event) { export function deletePicture() { return function(dispatch) { - return mpwoApi + return mpwoApiUser .deletePicture() .then(ret => { if (ret.status === 'success') { diff --git a/mpwo_client/src/components/NavBar/index.jsx b/mpwo_client/src/components/NavBar/index.jsx index 51343ecb..9c097264 100644 --- a/mpwo_client/src/components/NavBar/index.jsx +++ b/mpwo_client/src/components/NavBar/index.jsx @@ -2,7 +2,7 @@ import React from 'react' import { connect } from 'react-redux' import { Link } from 'react-router-dom' -import mpwoApi from '../../mpwoApi' +import { apiUrl } from '../../utils' function NavBar (props) { @@ -74,7 +74,7 @@ function NavBar (props) { {props.user.picture === true && ( diff --git a/mpwo_client/src/components/User/Profile.jsx b/mpwo_client/src/components/User/Profile.jsx index 63551098..ce225889 100644 --- a/mpwo_client/src/components/User/Profile.jsx +++ b/mpwo_client/src/components/User/Profile.jsx @@ -4,8 +4,8 @@ import { Helmet } from 'react-helmet' import { connect } from 'react-redux' import { Link } from 'react-router-dom' -import mpwoApi from '../../mpwoApi' import { deletePicture, uploadPicture } from '../../actions' +import { apiUrl } from '../../utils' function Profile ({ message, onDeletePicture, onUploadPicture, user }) { return ( @@ -49,7 +49,7 @@ function Profile ({ message, onDeletePicture, onUploadPicture, user }) {