diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2022-12-04 21:37:52 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.xyz> | 2022-12-04 21:37:52 +0530 |
commit | 1139da4da7f1bb0ee4a66d420e690beed36832c2 (patch) | |
tree | b0e5fca2f13c691b0c42543d98a747289f527e52 /src/views/homepage.js | |
parent | bb38d843de17bb0b206a663e008c5dbb37f04708 (diff) |
added notification system
Diffstat (limited to 'src/views/homepage.js')
-rw-r--r-- | src/views/homepage.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/views/homepage.js b/src/views/homepage.js index a9cdb50..92f9544 100644 --- a/src/views/homepage.js +++ b/src/views/homepage.js @@ -15,9 +15,22 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Link } from 'react-router-dom'; +import { Link, useNavigate } from 'react-router-dom'; +import { notificationConfig } from "../classes/notifications"; +import { Store } from "react-notifications-component"; const HomePage = () => { + // this is temporary, just for testing + // TODO: find better way to do this + const navigate = useNavigate(); + if (!localStorage.getItem("accessToken")) { + Store.addNotification({ + title: "You are not logged in", + message: "You need to log in before accessing this page.", + ...notificationConfig("default") + }); + navigate("/login") + } return ( <> <h1>Welcome to OpenBills</h1> |