Skip to content

Commit

Permalink
Fixed user info navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
fgall002 committed Dec 4, 2019
1 parent ec94508 commit bff78c9
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 34 deletions.
7 changes: 5 additions & 2 deletions src/Navigation/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import Login from '../authentication/User/LoginScreen'
import MainScreen from '../components/MainScreen'
import Feed from '../components/Feed'
import myMap from '../components/myMap'
// import UserInfo from '../components/UserInfo'
import UserInfo from '../components/UserInfo'


import AuthWorkspacesScreen from '../Screens/WorkSpace/user/AuthWorkspacesScreen2v'
Expand Down Expand Up @@ -103,11 +103,14 @@ const Drawer = createDrawerNavigator(
},
)



const Authentication = createStackNavigator(
{
AuthenticationMenu: AuthenticationMenu,
SignUp: SignUp,
Login:Login
Login:Login,
UserInfo:UserInfo
},
{
defaultNavigationOptions: {
Expand Down
2 changes: 0 additions & 2 deletions src/Screens/WorkSpace/Member/UserJoinWorkspacesScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ const UserWorkspaceSettings = props => {


if(findWorkspace && !validAccessCode){
console.log("Hello world")
const updatedMemberList = memberList.concat(AuthID)
console.log("After append, ", updatedMemberList)
dispatch(
workspacesAction.joinWorkspace(
findWorkspace.id,
Expand Down
3 changes: 0 additions & 3 deletions src/Screens/WorkSpace/user/AuthEdithWorkspaceScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,13 @@ const EditWorkspaceScreen = props => {

if(formState.inputValues.emails){

console.log("Email: ", formState.inputValues.emails)
const stripEmails= formState.inputValues.emails.split(',')
console.log("Strip: ", stripEmails)
workspacesAction.addMembers(
stripEmails,
formState.inputValues.workspaceTitle,
editedWorkspace.accessCode
)
}
console.log("Submitted")
props.navigation.goBack();
}, [dispatch, workspaceId, formState])

Expand Down
2 changes: 1 addition & 1 deletion src/authentication/User/SignUpScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const SignUpScreen = props => {
setError(null);
try {
await dispatch(action)
props.navigation.navigate('UserInfoRouteSignUp')
props.navigation.navigate('UserInfo')
Alert.alert('Congratulation', 'You Have Successfully Sign Up',[{text:'Okay'}])
} catch (err) {
setError(err.message);
Expand Down
4 changes: 2 additions & 2 deletions src/authentication/component/utilites/ImagePicker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react'
import React, { useState, useEffect } from 'react'
import * as firebase from 'firebase'

import { View, Button, Text, StyleSheet, Image , Alert} from 'react-native'
Expand Down Expand Up @@ -29,7 +29,7 @@ const ImagePicker = props => {
quality: 0.5
})

const hello = await uploadImage(image.uri)
await uploadImage(image.uri)
.then(()=> {
console.log("Success")
})
Expand Down
1 change: 0 additions & 1 deletion src/authentication/store/Action/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const addImage = ( workspaceId,image) => {
to : newPath
});
} catch(error){
console.log(error);
throw error
}

Expand Down
21 changes: 0 additions & 21 deletions src/authentication/store/Action/workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export const createWorkSpace = (workspaceTitle, color, imageUri) => {
return async (dispatch, getState )=> {
const authID = getState().userAuth.userId
const accessCode = makeId(5)
//console.log("user id", userID)
const response = await fetch('https://lokos-studybuddy.firebaseio.com/workspaces.json', {
method: 'POST',
headers: {
Expand Down Expand Up @@ -161,7 +160,6 @@ export const updateWorkSpace = (id, workspaceTitle, color, imageUri) => {
export const joinWorkspace = (id,members) => {
return async (dispatch, getState) => {
const authID = getState().userAuth.userId
console.log("Members: ", members)
const response = await fetch(`https://lokos-studybuddy.firebaseio.com/workspaces/${id}.json`,
{
method: 'PATCH',
Expand All @@ -174,7 +172,6 @@ export const joinWorkspace = (id,members) => {
}
);

console.log("hello")
await firebase.database().ref(`/Users/${authID}/workspaces/`).once('value').then(async function(snapshot){
let userWorkspaces = snapshot.val()
let updatedWorkspace = []
Expand All @@ -187,8 +184,6 @@ export const joinWorkspace = (id,members) => {
updatedWorkspace.push(id)
}

console.log("UserWorkspaces: ", updatedWorkspace)

await firebase.database().ref(`/Users/${authID}/workspaces/`).update(updatedWorkspace)
})

Expand All @@ -210,19 +205,3 @@ export const joinWorkspace = (id,members) => {
});
};
};

// export const updateUserWorkspace = (id) => {
// return async(dispatch, getState) => {
// console.log("Hello worlds")
// const authID = getState().userAuth.userId
// console.log("AuthID, ", authID)




// dispatch({
// });
// }


// }
1 change: 0 additions & 1 deletion src/authentication/store/Reducer/workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default(state = initialState, action) => {
}
case CREATE_WORKSPACE:
const accessCode = action.workspaceData.id.substring(0,5)
console.log("Access Code: ", accessCode)
const newWorkSpace = new Workspace(
action.workspaceData.id,
action.workspaceData.workspaceTitle,
Expand Down
2 changes: 1 addition & 1 deletion src/components/UserInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default class UserInfo extends Component{
console.log(output)
console.log("pushing into firebase")
await firebase.database().ref('Users/' + this.state.userId + '/').update(output)
this.props.navigation.navigate('MainRoute')
this.props.navigation.navigate('MainScreenDrawer')
Alert.alert('Notice','Successfully updated profile!',[{text:'Okay'}])

}
Expand Down

0 comments on commit bff78c9

Please sign in to comment.