-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from atlp-rwanda/ft-login
#16 Implement Login Functionality
- Loading branch information
Showing
26 changed files
with
553 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { AppDispatch } from '../../redux/store'; | ||
import { clearCredentials } from '../../redux/reducers/authReducer'; | ||
import { useDispatch } from 'react-redux'; | ||
|
||
function DesktopMenu() { | ||
const dispatch = useDispatch<AppDispatch>(); | ||
|
||
const logoutHandler = () => { | ||
dispatch(clearCredentials('')); | ||
}; | ||
|
||
return ( | ||
<div className="bg-baseWhite border border-neutral-300 rounded-2 w-48 p-1 text-neutral-600"> | ||
<ul className="flex flex-col "> | ||
<li className="hover:bg-neutral-300 pl-5 py-2 cursor-pointer">WishList</li> | ||
<li className="hover:bg-neutral-300 pl-5 py-2 cursor-pointer">Profile</li> | ||
<li onClick={logoutHandler} className="hover:bg-neutral-300 pl-5 py-2 cursor-pointer"> | ||
Logout | ||
</li> | ||
</ul> | ||
</div> | ||
); | ||
} | ||
|
||
export default DesktopMenu; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { useEffect } from 'react'; | ||
import axios from 'axios'; | ||
import { useDispatch } from 'react-redux'; | ||
import { AppDispatch } from '../../redux/store'; | ||
import PropagateLoader from 'react-spinners/PropagateLoader'; | ||
import { clearCredentials, setCredentials } from '../../redux/reducers/authReducer'; | ||
|
||
const GoogleLoginSuccess = () => { | ||
const dispatch = useDispatch<AppDispatch>(); | ||
useEffect(() => { | ||
axios | ||
.get(`${import.meta.env.VITE_APP_API_URL}/user/login/success`, { withCredentials: true }) | ||
.then((response) => { | ||
dispatch(setCredentials(response.data.data.token)); | ||
}) | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
.catch((error) => { | ||
dispatch(clearCredentials('')); | ||
}); | ||
}, [dispatch]); | ||
|
||
return ( | ||
<div className="flex flex-col justify-center items-center min-h-[60vh] bg-background3 text-baseBlack"> | ||
<div className="bg-black mb-10"> | ||
<PropagateLoader color="#070F2B" /> | ||
</div> | ||
<span className="text-lg pl-4">Signing in with Google </span> | ||
<span className="text-neutrals700 italic text-sm pl-4">Please wait a moment.</span> | ||
</div> | ||
); | ||
}; | ||
|
||
export default GoogleLoginSuccess; |
Oops, something went wrong.