mirror of
https://github.com/lemeow125/Reactnative-notesapp.git
synced 2024-11-17 06:29:27 +08:00
Finished up userinfo page and removed forgot password from login
This commit is contained in:
parent
9851c426e0
commit
2ba28ac8dd
2 changed files with 30 additions and 32 deletions
|
@ -66,10 +66,6 @@ export default function Login() {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<TouchableOpacity>
|
|
||||||
<Text style={styles.forgot_button}>Forgot Password?</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
setUser({
|
setUser({
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
import * as React from 'react';
|
import * as React from "react";
|
||||||
import {View, Text} from 'react-native';
|
import { View, Text } from "react-native";
|
||||||
import styles from '../../styles';
|
import styles from "../../styles";
|
||||||
import Background from '../../Components/Background/Background';
|
import Background from "../../Components/Background/Background";
|
||||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
import { SafeAreaView } from "react-native-safe-area-context";
|
||||||
import { UserInfo } from '../../Components/Api/Api';
|
import { UserInfo } from "../../Components/Api/Api";
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery } from "react-query";
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from "react-redux";
|
||||||
import { RootState } from '../../Features/Redux/Store/Store';
|
import { RootState } from "../../Features/Redux/Store/Store";
|
||||||
|
|
||||||
export default function UserPage() {
|
export default function UserPage() {
|
||||||
const { data, isLoading, error } = useQuery("user", UserInfo, { retry: 0, onSuccess: (data) => console.log(data) });
|
const { data, isLoading, error } = useQuery("user", UserInfo, {
|
||||||
const logged_in = useSelector(
|
retry: 0,
|
||||||
(state: RootState) => state.logged_in.value
|
onSuccess: (data) => console.log(data),
|
||||||
);
|
});
|
||||||
const logged_in_user = useSelector(
|
const logged_in = useSelector((state: RootState) => state.logged_in.value);
|
||||||
(state: RootState) => state.logged_in_user.value
|
|
||||||
);
|
|
||||||
if (isLoading && !error) {
|
if (isLoading && !error) {
|
||||||
return (
|
return (
|
||||||
<View style={styles.background}>
|
<View style={styles.background}>
|
||||||
<View style={styles.addnotecont}>
|
<View style={styles.addnotecont}>
|
||||||
<Text style={styles.typeinput}>Loading...</Text>
|
<Text style={{ ...styles.text_white, ...{ fontSize: 25 } }}>
|
||||||
|
Loading...
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
@ -28,7 +28,9 @@ export default function UserPage() {
|
||||||
return (
|
return (
|
||||||
<View style={styles.background}>
|
<View style={styles.background}>
|
||||||
<View style={styles.addnotecont}>
|
<View style={styles.addnotecont}>
|
||||||
<Text style={styles.typeinput}>An error has occured</Text>
|
<Text style={{ ...styles.text_white, ...{ fontSize: 25 } }}>
|
||||||
|
An error has occured
|
||||||
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
@ -36,16 +38,16 @@ export default function UserPage() {
|
||||||
return (
|
return (
|
||||||
<Background>
|
<Background>
|
||||||
<View style={styles.addnotecont}>
|
<View style={styles.addnotecont}>
|
||||||
<SafeAreaView>
|
<Text style={{ ...styles.text_white, ...{ fontSize: 25 } }}>
|
||||||
<View style={styles.background}>
|
Username: {data.username}
|
||||||
<View style={styles.title}>
|
</Text>
|
||||||
<Text style={styles.typeinput}>Username: {logged_in_user.username}</Text>
|
<Text style={{ ...styles.text_white, ...{ fontSize: 25 } }}>
|
||||||
<Text style={styles.typeinput}>Email: {logged_in_user.email}</Text>
|
Email: {data.email}
|
||||||
<Text style={styles.typeinput}>User ID: {logged_in_user.id}</Text>
|
</Text>
|
||||||
</View>
|
<Text style={{ ...styles.text_white, ...{ fontSize: 25 } }}>
|
||||||
</View>
|
User ID: {data.id}
|
||||||
</SafeAreaView>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</Background>
|
</Background>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue