Overhauled redux states and separated auth state from user info state

This commit is contained in:
Keannu Christian Bernasol 2023-07-06 20:56:19 +08:00
parent acfb28ce3c
commit 9a246b45e1
6 changed files with 65 additions and 37 deletions

View file

@ -14,7 +14,7 @@ import DrawerButton from "../Button/DrawerButton";
import { useDispatch, useSelector } from "react-redux";
import { RootState } from "../../features/redux/Store/Store";
import LogoutIcon from "../../icons/LogoutIcon/LogoutIcon";
import { clear } from "../../features/redux/slices/AuthSlice/AuthSlice";
import { logout } from "../../features/redux/slices/AuthSlice/AuthSlice";
import AsyncStorage from "@react-native-async-storage/async-storage";
export default function CustomDrawerContent(props: {}) {
@ -47,7 +47,7 @@ export default function CustomDrawerContent(props: {}) {
<DrawerButton
color={colors.blue_2}
onPress={async () => {
dispatch(await clear());
dispatch(logout());
await AsyncStorage.clear();
navigation.navigate("Login");
}}
@ -69,15 +69,6 @@ export default function CustomDrawerContent(props: {}) {
<AppIcon size={32} />
<Text style={styles.text_white_medium}>Stud-E</Text>
</View>
<DrawerButton
color={colors.blue_2}
onPress={() => {
navigation.navigate("Home");
}}
>
<HomeIcon size={32} />
<Text style={styles.text_white_medium}>Home</Text>
</DrawerButton>
<DrawerButton
color={colors.blue_2}
onPress={() => {
@ -90,7 +81,6 @@ export default function CustomDrawerContent(props: {}) {
<DrawerButton
color={colors.blue_2}
onPress={() => {
dispatch(clear());
navigation.navigate("Register");
}}
>