mirror of
https://github.com/lemeow125/Reactnative-notesapp.git
synced 2024-11-16 22:19:26 +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 AppIcon from "../../../Icons/AppIcon/AppIcon";
|
||||
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 { Toggle_Login } from "../../../../Features/Redux/Slices/LoginSlice/LoginSlice";
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
|
||||
export default function CustomDrawerContent(props: {}) {
|
||||
const navigation = useNavigation<RootDrawerParamList>();
|
||||
const dispatch = useDispatch();
|
||||
const width = 224;
|
||||
const logged_in = useSelector((state: RootState) => state.logged_in.value);
|
||||
const logged_in_user = useSelector(
|
||||
|
@ -82,7 +85,8 @@ export default function CustomDrawerContent(props: {}) {
|
|||
color="Red"
|
||||
width={width}
|
||||
onPress={() => {
|
||||
navigation.navigate("Register");
|
||||
dispatch(Toggle_Login());
|
||||
AsyncStorage.removeItem("token");
|
||||
}}
|
||||
>
|
||||
<LogoutIcon size={32} color="white" />
|
||||
|
|
Loading…
Reference in a new issue