update: token into headers update

parent 5261cb71
...@@ -7,6 +7,9 @@ import { homeStack } from "./Navigations/homeStack"; ...@@ -7,6 +7,9 @@ import { homeStack } from "./Navigations/homeStack";
import { AuthStack } from "./Navigations/AuthStack"; import { AuthStack } from "./Navigations/AuthStack";
import { FontAwesome } from '@expo/vector-icons'; import { FontAwesome } from '@expo/vector-icons';
import { AboutUs } from './screen/AboutUs'; import { AboutUs } from './screen/AboutUs';
// import {HomeScreen} from './screen/HomeScreen'; // import {HomeScreen} from './screen/HomeScreen';
// import {HomeScreen} from './screen/HomeScreen' // import {HomeScreen} from './screen/HomeScreen'
// import {BottomTab} from './Navigations/BottomTab'; // import {BottomTab} from './Navigations/BottomTab';
......
// import React from 'react'; // // import React from 'react';
// // import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs';
// // import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
// // import { HomeScreen } from "../screen/HomeScreen";
// // const Tab = createMaterialBottomTabNavigator();
// // export function BottomTab() {
// // return (
// // <Tab.Navigator
// // initialRouteName="HomeScreen"
// // screenOptions={{
// // tabBarActiveTintColor: '#e91e63',
// // }}
// // >
// // <Tab.Screen
// // name="HomeScreen"
// // component={HomeScreen}
// // options={{
// // tabBarLabel: 'Home',
// // tabBarIcon: ({ color, size }) => (
// // <MaterialCommunityIcons name="home" color={color} size={size} />
// // ),
// // }}
// // />
// // </Tab.Navigator>
// // );
// // }
// import React from 'react';
// import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs'; // import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs';
// import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'; // import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
// import { HomeScreen } from "../screen/HomeScreen";
// // import { gamification } from '../screen/gamification';
// // import { Leaderboard } from '../screen/Leaderboard';
// import PriceScreen from '../screen/PriceScreen';
// const Tab = createMaterialBottomTabNavigator(); // const Tab = createMaterialBottomTabNavigator();
// export function BottomTab() { // export function MyTabs() {
// return ( // return (
// <Tab.Navigator // <Tab.Navigator
// initialRouteName="HomeScreen" // initialRouteName="Feed"
// screenOptions={{ // activeColor="#e91e63"
// tabBarActiveTintColor: '#e91e63', // barStyle={{ backgroundColor: 'tomato' }}
// }}
// > // >
// <Tab.Screen // <Tab.Screen
// name="HomeScreen" // name="Feed"
// component={HomeScreen} // component={Feed}
// options={{ // options={{
// tabBarLabel: 'Home', // tabBarLabel: 'Home',
// tabBarIcon: ({ color, size }) => ( // tabBarIcon: ({ color }) => (
// <MaterialCommunityIcons name="home" color={color} size={size} /> // <MaterialCommunityIcons name="home" color={color} size={26} />
// ), // ),
// }} // }}
// /> // />
// {/* <Tab.Screen
// name="PriceScreen"
// component={PriceScreen}
// options={{
// tabBarLabel: 'Updates',
// tabBarIcon: ({ color }) => (
// <MaterialCommunityIcons name="bell" color={color} size={26} />
// ),
// }}
// /> */}
// {/* <Tab.Screen
// name="gamification"
// component={gamification}
// options={{
// tabBarLabel: 'Profile',
// tabBarIcon: ({ color }) => (
// <MaterialCommunityIcons name="account" color={color} size={26} />
// ),
// }}
// /> */}
// </Tab.Navigator> // </Tab.Navigator>
// ); // );
// } // }
\ No newline at end of file
...@@ -3843,6 +3843,11 @@ ...@@ -3843,6 +3843,11 @@
"resolved": "https://registry.npmjs.org/expo-keep-awake/-/expo-keep-awake-9.1.2.tgz", "resolved": "https://registry.npmjs.org/expo-keep-awake/-/expo-keep-awake-9.1.2.tgz",
"integrity": "sha512-CCuEOQUNLYtMA0rt0sQ9u5LlIMH7lDJG7dImoorfKMsP95yHXy8dl3oCdtaz2zbsPgggVYeom9gE+gQu+Ki4rQ==" "integrity": "sha512-CCuEOQUNLYtMA0rt0sQ9u5LlIMH7lDJG7dImoorfKMsP95yHXy8dl3oCdtaz2zbsPgggVYeom9gE+gQu+Ki4rQ=="
}, },
"expo-secure-store": {
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/expo-secure-store/-/expo-secure-store-10.2.0.tgz",
"integrity": "sha512-yNahMY3qzEotAYdsE02ps4yGfDay2twasHfsI/7gJB9SrwXYFx5bJuCDk8uTo8jsm6psvDjO+9VMM2DSPHik2A=="
},
"expo-splash-screen": { "expo-splash-screen": {
"version": "0.10.2", "version": "0.10.2",
"resolved": "https://registry.npmjs.org/expo-splash-screen/-/expo-splash-screen-0.10.2.tgz", "resolved": "https://registry.npmjs.org/expo-splash-screen/-/expo-splash-screen-0.10.2.tgz",
......
...@@ -19,7 +19,7 @@ import { ...@@ -19,7 +19,7 @@ import {
} from "@expo/vector-icons"; } from "@expo/vector-icons";
import { MaterialIcons } from "@expo/vector-icons"; import { MaterialIcons } from "@expo/vector-icons";
import { gamification } from "./gamification"; import { gamification } from "./gamification";
// import {MyTabs} from '../Navigations/BottomTab'
// import BottomTab from "../Navigations/BottomTab"; // import BottomTab from "../Navigations/BottomTab";
export function HomeScreen({ navigation }) { export function HomeScreen({ navigation }) {
//to diable the yellow box warning on the simulator //to diable the yellow box warning on the simulator
...@@ -98,7 +98,7 @@ export function HomeScreen({ navigation }) { ...@@ -98,7 +98,7 @@ export function HomeScreen({ navigation }) {
<Text style={styles.heading2}>All Right Reserved.</Text> <Text style={styles.heading2}>All Right Reserved.</Text>
</ImageBackground> </ImageBackground>
{/* <BottomTab/> */} {/* <MyTabs/> */}
</View> </View>
); );
} }
......
...@@ -102,6 +102,10 @@ export function PriceScreen({ navigation, data }) { ...@@ -102,6 +102,10 @@ export function PriceScreen({ navigation, data }) {
); );
} }
function dbDetails(){
}
const form = new FormData (); const form = new FormData ();
form.append("name", details.name) form.append("name", details.name)
...@@ -193,7 +197,7 @@ export function PriceScreen({ navigation, data }) { ...@@ -193,7 +197,7 @@ export function PriceScreen({ navigation, data }) {
// ref={passwordInputRef} // ref={passwordInputRef}
// onSubmitEditing={Keyboard.dismiss} // onSubmitEditing={Keyboard.dismiss}
blurOnSubmit={false} blurOnSubmit={false}
secureTextEntry={true} secureTextEntry={false}
/> />
</View> </View>
{details.isValiddistrict ? null : ( {details.isValiddistrict ? null : (
......
...@@ -11,6 +11,10 @@ import { ...@@ -11,6 +11,10 @@ import {
import { Entypo } from "@expo/vector-icons"; import { Entypo } from "@expo/vector-icons";
import axios from "axios"; import axios from "axios";
import { State } from "react-native-gesture-handler"; import { State } from "react-native-gesture-handler";
import * as SecureStore from 'expo-secure-store'
export function SignIn({ navigation }) { export function SignIn({ navigation }) {
...@@ -122,13 +126,20 @@ export function SignIn({ navigation }) { ...@@ -122,13 +126,20 @@ export function SignIn({ navigation }) {
<TouchableOpacity <TouchableOpacity
style={styles.buttonSub} style={styles.buttonSub}
activeOpacity={0.5} activeOpacity={0.5}
onPress={() => onPress={ () =>
axios.post("http://192.168.8.126:5000/login", form) axios.post("http://192.168.8.126:5000/login", form)
.then(function (response) { .then( async function (response) {
const stngobj = JSON.stringify(response.data) // const stngobj = JSON.stringify()
console.log(stngobj + "logged"); console.log(response.data);
alert("Successfully Logged in") // alert("Successfully Logged in");
await SecureStore.setItemAsync("token", response.data.token);
axios.defaults.headers.common = {
authorization : response.data.token
}
navigation.navigate("HomeScreen") navigation.navigate("HomeScreen")
// return response; // return response;
}) })
.catch(function (error) { .catch(function (error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment