mirror of
https://github.com/lemeow125/Reactnative-notesapp.git
synced 2024-11-17 06:29:27 +08:00
Made logout button functional
This commit is contained in:
parent
c782851c48
commit
3c188f9ad7
1 changed files with 6 additions and 2 deletions
|
@ -14,11 +14,14 @@ import SignupIcon from "../../../Icons/SignupIcon/SignupIcon";
|
||||||
import UserIcon from "../../../Icons/UserIcon/UserIcon";
|
import UserIcon from "../../../Icons/UserIcon/UserIcon";
|
||||||
import AppIcon from "../../../Icons/AppIcon/AppIcon";
|
import AppIcon from "../../../Icons/AppIcon/AppIcon";
|
||||||
import LogoutIcon from "../../../Icons/LogoutIcon/LogoutIcon";
|
import LogoutIcon from "../../../Icons/LogoutIcon/LogoutIcon";
|
||||||
import { useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { RootState } from "../../../../Features/Redux/Store/Store";
|
import { RootState } from "../../../../Features/Redux/Store/Store";
|
||||||
|
import { Toggle_Login } from "../../../../Features/Redux/Slices/LoginSlice/LoginSlice";
|
||||||
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||||
|
|
||||||
export default function CustomDrawerContent(props: {}) {
|
export default function CustomDrawerContent(props: {}) {
|
||||||
const navigation = useNavigation<RootDrawerParamList>();
|
const navigation = useNavigation<RootDrawerParamList>();
|
||||||
|
const dispatch = useDispatch();
|
||||||
const width = 224;
|
const width = 224;
|
||||||
const logged_in = useSelector((state: RootState) => state.logged_in.value);
|
const logged_in = useSelector((state: RootState) => state.logged_in.value);
|
||||||
const logged_in_user = useSelector(
|
const logged_in_user = useSelector(
|
||||||
|
@ -82,7 +85,8 @@ export default function CustomDrawerContent(props: {}) {
|
||||||
color="Red"
|
color="Red"
|
||||||
width={width}
|
width={width}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navigation.navigate("Register");
|
dispatch(Toggle_Login());
|
||||||
|
AsyncStorage.removeItem("token");
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<LogoutIcon size={32} color="white" />
|
<LogoutIcon size={32} color="white" />
|
||||||
|
|
Loading…
Reference in a new issue