mirror of
https://github.com/lemeow125/Borrowing-TrackerFrontend.git
synced 2024-11-17 06:19:27 +08:00
Renamed authentication method
This commit is contained in:
parent
41a37fcb4b
commit
139c0a3e3c
2 changed files with 4 additions and 4 deletions
|
@ -12,7 +12,7 @@ import Button from "../Buttons/Button";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { LoginAPI } from "../API/API";
|
import { LoginAPI } from "../API/API";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { Toggle_Login } from "../Plugins/Redux/Slices/AuthSlice/AuthSlice";
|
import { auth_toggle } from "../Plugins/Redux/Slices/AuthSlice/AuthSlice";
|
||||||
export default function LoginModal() {
|
export default function LoginModal() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [showPassword, setShowPassword] = useState(false);
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
|
@ -128,7 +128,7 @@ export default function LoginModal() {
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
const status = await LoginAPI(user);
|
const status = await LoginAPI(user);
|
||||||
if (status === true) {
|
if (status === true) {
|
||||||
await dispatch(Toggle_Login());
|
await dispatch(auth_toggle());
|
||||||
navigate("/dashboard");
|
navigate("/dashboard");
|
||||||
} else {
|
} else {
|
||||||
setError("Invalid login");
|
setError("Invalid login");
|
||||||
|
|
|
@ -7,13 +7,13 @@ export const AuthSlice = createSlice({
|
||||||
value: false,
|
value: false,
|
||||||
},
|
},
|
||||||
reducers: {
|
reducers: {
|
||||||
Toggle_Login: (state) => {
|
auth_toggle: (state) => {
|
||||||
state.value = !state.value;
|
state.value = !state.value;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// Action creators are generated for each case reducer function
|
// Action creators are generated for each case reducer function
|
||||||
export const { Toggle_Login } = AuthSlice.actions;
|
export const { auth_toggle } = AuthSlice.actions;
|
||||||
|
|
||||||
export default AuthSlice.reducer;
|
export default AuthSlice.reducer;
|
||||||
|
|
Loading…
Reference in a new issue