diff --git a/mpwo_api/mpwo_api/users/auth.py b/mpwo_api/mpwo_api/users/auth.py index cf41233d..139d631f 100644 --- a/mpwo_api/mpwo_api/users/auth.py +++ b/mpwo_api/mpwo_api/users/auth.py @@ -1,6 +1,6 @@ import datetime import os -from flask import Blueprint, current_app, jsonify, request, send_from_directory +from flask import Blueprint, current_app, jsonify, request from sqlalchemy import exc, or_ from werkzeug.utils import secure_filename diff --git a/mpwo_client/package.json b/mpwo_client/package.json index f9d0b080..09cd1ef6 100644 --- a/mpwo_client/package.json +++ b/mpwo_client/package.json @@ -3,6 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { + "date-fns": "^1.29.0", "history": "^4.7.2", "react": "^16.2.0", "react-dom": "^16.2.0", diff --git a/mpwo_client/src/actions/index.js b/mpwo_client/src/actions/index.js index ccc3aa43..274db981 100644 --- a/mpwo_client/src/actions/index.js +++ b/mpwo_client/src/actions/index.js @@ -23,8 +23,8 @@ function ProfileError(message) { return { type: 'PROFILE_ERROR', message } } -function PwdError(message) { - return { type: 'PWD_ERROR', message } +function ProfileUpdateError(message) { + return { type: 'PROFILE_UPDATE_ERROR', message } } function initProfileFormData(user) { @@ -157,7 +157,9 @@ export function handleProfileFormSubmit(event) { const state = getState() if (!state.formProfile.formProfile.password === state.formProfile.formProfile.passwordConf) { - dispatch(PwdError('Password and password confirmation don\'t match.')) + dispatch(ProfileUpdateError( + 'Password and password confirmation don\'t match.' + )) } else { return mpwoApi .updateProfile(state.formProfile.formProfile) @@ -166,7 +168,7 @@ export function handleProfileFormSubmit(event) { getProfile(dispatch) history.push('/profile') } else { - dispatch(AuthError(ret.message)) + dispatch(ProfileUpdateError(ret.message)) } }) .catch(error => { diff --git a/mpwo_client/src/components/User/Profile.jsx b/mpwo_client/src/components/User/Profile.jsx index 9d69f2c2..86ce7dfe 100644 --- a/mpwo_client/src/components/User/Profile.jsx +++ b/mpwo_client/src/components/User/Profile.jsx @@ -1,3 +1,4 @@ +import { format } from 'date-fns' import React from 'react' import { Helmet } from 'react-helmet' import { connect } from 'react-redux' @@ -33,13 +34,15 @@ function Profile ({ message, onDeletePicture, onUploadPicture, user }) {
Email : {user.email}
-Registration Date : {user.createdAt}
-First Name : {user.firstName}
-Last Name : {user.lastName}
-Birth Date : {user.birthDate}
-Location : {user.location}
-Bio : {user.bio}
+Email: {user.email}
+Registration Date: { + format(new Date(user.createdAt), 'DD/MM/YYYY HH:mm') + }
+First Name: {user.firstName}
+Last Name: {user.lastName}
+Birth Date: {user.birthDate}
+Location: {user.location}
+Bio: {user.bio}