diff --git a/client/App.js b/client/App.js index 9e8f374..6513778 100644 --- a/client/App.js +++ b/client/App.js @@ -1,20 +1,22 @@ import React from 'react'; -import {createStore, applyMiddleware} from 'redux'; -import {Provider} from 'react-redux'; -import reducer from './src/redux/reducer'; -import thunk from 'redux-thunk'; -import Dashboard from './src/components/Dashboard'; +import { createStore, applyMiddleware } from 'redux' +import { Provider } from 'react-redux' +import reducer from './src/redux/reducer' +import thunk from 'redux-thunk' +import Dashboard from './src/components/Dashboard' +import Login from './src/components/Login' import NoteList from './src/components/NoteList'; -import {createAppContainer} from 'react-navigation'; -import {createStackNavigator} from 'react-navigation-stack'; +import { createAppContainer } from 'react-navigation'; +import { createStackNavigator } from 'react-navigation-stack'; -import {View, StyleSheet, Text} from 'react-native'; +import { View, StyleSheet, Text } from 'react-native'; const navigationStak = createStackNavigator({ - Dashboard: {screen: Dashboard}, - NoteList: {screen: NoteList}, + Login: { screen: Login }, + Dashboard: { screen: Dashboard }, + NoteList: { screen: NoteList }, }); const store = createStore(reducer, applyMiddleware(thunk)); diff --git a/client/src/components/Dashboard/index.js b/client/src/components/Dashboard/index.js index 46dafd1..09fa2b6 100644 --- a/client/src/components/Dashboard/index.js +++ b/client/src/components/Dashboard/index.js @@ -1,5 +1,5 @@ import React from 'react' -import { getAllCategories } from '../../redux/action' +import { getAllCategories, logOut } from '../../redux/action' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' @@ -10,6 +10,8 @@ import { View, FlatList, Image, + Button, + TouchableOpacity } from 'react-native'; class Dashboard extends React.Component { @@ -18,32 +20,41 @@ class Dashboard extends React.Component { this.props.getAllCategories() } moveToList = () => { - // this should done after someye complete her work - // this.props.navigation.navigate('noteList') + this.props.navigation.navigate('NoteList') + } + logedOut = () => { + this.props.logOut() + this.props.navigation.navigate('Login') } - render() { + render() { return ( + {this.props.loading || !this.props.login ? loading + + : + ( - {this.props.loading ? Loading : ( - <> - - ( - + <> +