diff --git a/src/features/redux/slices/UserSlice/UserSlice.tsx b/src/features/redux/slices/UserSlice/UserSlice.tsx index f840470..3927136 100644 --- a/src/features/redux/slices/UserSlice/UserSlice.tsx +++ b/src/features/redux/slices/UserSlice/UserSlice.tsx @@ -1,9 +1,9 @@ import { createSlice } from "@reduxjs/toolkit"; export const UserSlice = createSlice({ - name: "Auth", + name: "User", initialState: { - creds: { + user: { email: "", uid: "", username: "", @@ -17,7 +17,7 @@ export const UserSlice = createSlice({ }, reducers: { setUser: (state, action) => { - state.creds = { + state.user = { email: action.payload.email, uid: action.payload.uid, username: action.payload.username, @@ -30,7 +30,7 @@ export const UserSlice = createSlice({ }; }, clear: (state) => { - state.creds = { + state.user = { email: "", uid: "", username: "", diff --git a/src/routes/Home/Home.tsx b/src/routes/Home/Home.tsx index 944d131..96c6532 100644 --- a/src/routes/Home/Home.tsx +++ b/src/routes/Home/Home.tsx @@ -6,7 +6,7 @@ import { RootState } from "../../features/redux/Store/Store"; import AnimatedContainer from "../../components/AnimatedContainer/AnimatedContainer"; export default function Home() { - const creds = useSelector((state: RootState) => state.auth.creds); + const creds = useSelector((state: RootState) => state.user.user); return ( diff --git a/src/routes/Login/Login.tsx b/src/routes/Login/Login.tsx index 40af8bb..7b8cc4c 100644 --- a/src/routes/Login/Login.tsx +++ b/src/routes/Login/Login.tsx @@ -17,13 +17,13 @@ import { RootDrawerParamList } from "../../interfaces/Interfaces"; import { UserInfo, UserLogin } from "../../components/Api/Api"; import { ParseLoginError } from "../../components/ParseError/ParseError"; import AnimatedContainer from "../../components/AnimatedContainer/AnimatedContainer"; -import { setUser as setStateUser } from "../../features/redux/slices/UserSlice/UserSlice"; +import { setUser } from "../../features/redux/slices/UserSlice/UserSlice"; import { login } from "../../features/redux/slices/AuthSlice/AuthSlice"; export default function Login() { const navigation = useNavigation(); const dispatch = useDispatch(); - const [user, setUser] = useState({ + const [creds, setCreds] = useState({ username: "", password: "", error: "", @@ -51,11 +51,11 @@ export default function Login() { placeholder="Username" placeholderTextColor="white" autoCapitalize="none" - value={user.username} + value={creds.username} onChange={( e: NativeSyntheticEvent ): void => { - setUser({ ...user, username: e.nativeEvent.text }); + setUser({ ...creds, username: e.nativeEvent.text }); }} /> @@ -64,27 +64,27 @@ export default function Login() { placeholder="Password" placeholderTextColor="white" secureTextEntry={true} - value={user.password} + value={creds.password} onChange={( e: NativeSyntheticEvent ): void => { - setUser({ ...user, password: e.nativeEvent.text }); + setUser({ ...creds, password: e.nativeEvent.text }); }} /> - {user.error} + {creds.error}