diff --git a/README.md b/README.md
index da26c4ad5..a8790edfb 100644
--- a/README.md
+++ b/README.md
@@ -20,9 +20,9 @@ App.js
| | |
| | |- UserTabs
| | | |
-| | | |- Tab 1 - AddUser
+| | | |- Tab 1 - UserUpdate
| | | |
-| | | |- Tab 2 - UpdateUser
+| | | |- Tab 2 - ManageImages
| |
| |- Browse
| | |
diff --git a/client/src/App.js b/client/src/App.js
index 0d9c6428a..03c3cd676 100644
--- a/client/src/App.js
+++ b/client/src/App.js
@@ -24,7 +24,7 @@ import Post from './components/Post';
import Footer from './components/Footer';
import Callback from './components/Callback';
-import Auth from './auth/index';
+import Auth from './auth/Auth';
// Apollo Client Setup
const httpLink = new HttpLink({ uri: 'http://localhost:4000/graphql', changeOrigin: true })
diff --git a/client/src/auth/index.js b/client/src/auth/Auth.js
similarity index 98%
rename from client/src/auth/index.js
rename to client/src/auth/Auth.js
index e7d84336c..b221ae134 100644
--- a/client/src/auth/index.js
+++ b/client/src/auth/Auth.js
@@ -8,8 +8,6 @@ import { client } from '../App'
import { AUTH_CONFIG } from './Auth0' // create by renaming Auth0.sample.js to Auth0.js and setting vars
-console.log(process.env.AUTH0_CLIENTID)
-
const AUTHENTICATE = gql`
mutation authenticate($idToken: String!) {
authenticate(idToken: $idToken) {
@@ -128,7 +126,7 @@ class Auth {
})
console.log('signinOrCreateAccount auth: ', await data)
- setItem('user', data.data.authenticate.authId)
+ setItem('user', JSON.stringify(data.data.authenticate))
if (window.location.href.includes(`callback`)) {
window.location.href = '/'
} else {
diff --git a/client/src/components/About.js b/client/src/components/About.js
index 5283ad55d..34b02a317 100644
--- a/client/src/components/About.js
+++ b/client/src/components/About.js
@@ -3,9 +3,9 @@ import React from 'react'
const About = () => {
return (
-
-
About
-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Recusandae repudiandae repellat illo magni eligendi cupiditate voluptates eius nam voluptate. Incidunt nihil ullam quae quia officia quaerat, deserunt eligendi explicabo totam?
+
+
About
+
This Module was developed by the AATeam. Contributions are welcomed.
)
diff --git a/client/src/components/AddUser.js b/client/src/components/AddUser.js
deleted file mode 100644
index 5d40d75c8..000000000
--- a/client/src/components/AddUser.js
+++ /dev/null
@@ -1,53 +0,0 @@
-import React, { Component } from 'react';
-import {graphql, compose} from 'react-apollo';
-import {getRolesQuery, addUserMutation, getUsersQuery} from '../queries/queries';
-
-import AddUserNextButton from './AddUserNextButton';
-
-class AddUser extends Component {
- constructor(props){
- super(props);
- this.state = {
- alias: '',
- authId: '1'
- };
- }
-
- submitForm(e){
-
- e.preventDefault();
- this.props.addUserMutation({
- variables: {
- alias: this.state.alias,
- authId: this.state.authId
- },
- refetchQueries: [{ query: getUsersQuery}] // This allow us to re run whatever queries are necesary after the mutation.
- });
- this.props.onAdded();
- }
-
- render(){
- return(
-
-
-
- );
- }
-}
-
-export default compose(
- graphql(getRolesQuery, {name: "getRolesQuery"}),
- graphql(addUserMutation, {name: "addUserMutation"})
-) (AddUser); // This technique binds more than one query to a single component.
diff --git a/client/src/components/Footer.js b/client/src/components/Footer.js
index df47f5326..5a2b475d7 100644
--- a/client/src/components/Footer.js
+++ b/client/src/components/Footer.js
@@ -14,7 +14,6 @@ const Footer = () => {
Links
Home
-
Profile
Browse
Search
Contact
diff --git a/client/src/components/Home.js b/client/src/components/Home.js
index 7768b4449..482c767b7 100644
--- a/client/src/components/Home.js
+++ b/client/src/components/Home.js
@@ -7,8 +7,6 @@ import React, { Component } from 'react'
// Images
import PortraitImage from '../img/portrait.jpg'
-import CityImage from '../img/city.jpg'
-import NatureImage from '../img/nature.jpg'
class Home extends Component {
@@ -27,24 +25,6 @@ class Home extends Component {
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum at lacus congue, suscipit elit nec, tincidunt orci.
-
-
-
-
-
-
Title 2
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum at lacus congue, suscipit elit nec, tincidunt orci.
-
-
-
-
-
-
-
-
Title 3
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum at lacus congue, suscipit elit nec, tincidunt orci.
-
-
diff --git a/client/src/components/LoggedInUser.js b/client/src/components/LoggedInUser.js
index 71c3e6ab4..7b6137d6d 100644
--- a/client/src/components/LoggedInUser.js
+++ b/client/src/components/LoggedInUser.js
@@ -13,10 +13,6 @@ class LoggedInUser extends Component {
if(user){
- console.log(user.firstName);
- console.log(user.lastName );
- console.log(user.alias);
-
let displayName = "No Display Name";
if (
@@ -38,7 +34,7 @@ class LoggedInUser extends Component {
return(
-
+
);
diff --git a/client/src/components/LoggedInUserMenu.js b/client/src/components/LoggedInUserMenu.js
index 803dde8de..248d6ec86 100644
--- a/client/src/components/LoggedInUserMenu.js
+++ b/client/src/components/LoggedInUserMenu.js
@@ -19,11 +19,16 @@ class LoggedInUserMenu extends Component {
constructor(props){
super(props);
this.state = {
- property: 'value'
+ user: {}
}
}
+ componentDidMount(){
+ this.setState({user: this.props.user});
+ }
+
render() {
+
return (
{({ anchorEl, updateAnchorEl }) => {
diff --git a/client/src/components/Logout.js b/client/src/components/Logout.js
index 4876ab330..0989985f7 100644
--- a/client/src/components/Logout.js
+++ b/client/src/components/Logout.js
@@ -1,9 +1,11 @@
import React, { Component } from 'react';
import {Redirect} from 'react-router';
+import {auth} from '../App';
class Logout extends Component {
render() {
- window.localStorage.removeItem("user");
+ //window.localStorage.removeItem("user");
+ auth.logout();
return
}
diff --git a/client/src/components/NavBar.js b/client/src/components/NavBar.js
index b590ef192..8d210e23b 100644
--- a/client/src/components/NavBar.js
+++ b/client/src/components/NavBar.js
@@ -49,24 +49,21 @@ class NavBar extends Component {
}
componentDidMount() {
- /*
- this._asyncRequest = window.localStorage.getItem('user').then(
- response => {
- this._asyncRequest = null;
- let user = JSON.parse(response)
- if (user) {
- const authId = user.sub;
- this.setState({ authId: authId });
- }
- }
- );
- */
+
const userStored = localStorage.getItem('user');
- console.log(userStored);
if (userStored !== null && userStored !== undefined && userStored !== 'undefined') {
const user = JSON.parse(userStored);
- const authId = user.sub;
+
+ /* For some reason, the result of GraphQL some times varies, that is why I had to do the following hack. */
+
+ let authId;
+ if (user.authId === undefined) {
+ authId = user.sub;
+ } else {
+ authId = user.authId;
+ }
+
this.setState({ authId: authId });
}
}
diff --git a/client/src/components/UserImages.js b/client/src/components/UserImages.js
new file mode 100644
index 000000000..08ba7c5e3
--- /dev/null
+++ b/client/src/components/UserImages.js
@@ -0,0 +1,14 @@
+import React from 'react'
+
+const UserImages = () => {
+ return (
+
+
+
Images Manager
+
This functionality has not been developed yet. Please visit this section later.
+
+
+ )
+}
+
+export default UserImages
diff --git a/client/src/components/UserTabs.js b/client/src/components/UserTabs.js
index ef6989956..67055b9e1 100644
--- a/client/src/components/UserTabs.js
+++ b/client/src/components/UserTabs.js
@@ -4,15 +4,14 @@ import { withStyles } from '@material-ui/core/styles';
import AppBar from '@material-ui/core/AppBar';
import Tabs from '@material-ui/core/Tabs';
import Tab from '@material-ui/core/Tab';
-import AddIcon from '@material-ui/icons/Add';
import UpdateIcon from '@material-ui/icons/Create';
import ImageIcon from '@material-ui/icons/Wallpaper';
import Typography from '@material-ui/core/Typography';
// Components
-import AddUser from './AddUser';
-import UpdateUser from './UpdateUser';
+import UserUpdate from './UserUpdate';
+import UserImages from './UserImages';
function TabContainer(props) {
return (
@@ -36,23 +35,16 @@ const styles = theme => ({
class UserTabs extends React.Component {
state = {
- value: 0,
- cureateDisabled: "false"
+ value: 0
};
handleChange = (event, value) => {
this.setState({ value });
};
- updateUser = () => {
- this.setState({ value: 1, cureateDisabled: "true" });
- };
-
render() {
const { classes } = this.props;
const { value } = this.state;
- const { createDisabled } = this.state;
-
return (