Skip to content
Snippets Groups Projects
Commit 87b67988 authored by Fin Wallis's avatar Fin Wallis
Browse files

re-configured routing to react router v6

parent d83cac2f
No related branches found
No related tags found
1 merge request!10re-configured routing to react router v6
......@@ -13,9 +13,11 @@
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"axios": "^0.24.0",
"history": "^5.2.0",
"js-cookie": "^3.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^6.2.1",
"react-scripts": "4.0.3",
"validator": "^13.7.0",
"web-vitals": "^1.0.1"
......@@ -9060,6 +9062,14 @@
"resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz",
"license": "MIT"
},
"node_modules/history": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/history/-/history-5.2.0.tgz",
"integrity": "sha512-uPSF6lAJb3nSePJ43hN3eKj1dTWpN9gMod0ZssbFTIsen+WehTmEadgL+kg78xLJFdRfrrC//SavDzmRVdE+Ig==",
"dependencies": {
"@babel/runtime": "^7.7.6"
}
},
"node_modules/hmac-drbg": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
......@@ -14541,6 +14551,30 @@
"node": ">=0.10.0"
}
},
"node_modules/react-router": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.2.1.tgz",
"integrity": "sha512-2fG0udBtxou9lXtK97eJeET2ki5//UWfQSl1rlJ7quwe6jrktK9FCCc8dQb5QY6jAv3jua8bBQRhhDOM/kVRsg==",
"dependencies": {
"history": "^5.2.0"
},
"peerDependencies": {
"react": ">=16.8"
}
},
"node_modules/react-router-dom": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.2.1.tgz",
"integrity": "sha512-I6Zax+/TH/cZMDpj3/4Fl2eaNdcvoxxHoH1tYOREsQ22OKDYofGebrNm6CTPUcvLvZm63NL/vzCYdjf9CUhqmA==",
"dependencies": {
"history": "^5.2.0",
"react-router": "6.2.1"
},
"peerDependencies": {
"react": ">=16.8",
"react-dom": ">=16.8"
}
},
"node_modules/react-scripts": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-4.0.3.tgz",
......@@ -25875,6 +25909,14 @@
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz"
},
"history": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/history/-/history-5.2.0.tgz",
"integrity": "sha512-uPSF6lAJb3nSePJ43hN3eKj1dTWpN9gMod0ZssbFTIsen+WehTmEadgL+kg78xLJFdRfrrC//SavDzmRVdE+Ig==",
"requires": {
"@babel/runtime": "^7.7.6"
}
},
"hmac-drbg": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
......@@ -29657,6 +29699,23 @@
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz"
},
"react-router": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.2.1.tgz",
"integrity": "sha512-2fG0udBtxou9lXtK97eJeET2ki5//UWfQSl1rlJ7quwe6jrktK9FCCc8dQb5QY6jAv3jua8bBQRhhDOM/kVRsg==",
"requires": {
"history": "^5.2.0"
}
},
"react-router-dom": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.2.1.tgz",
"integrity": "sha512-I6Zax+/TH/cZMDpj3/4Fl2eaNdcvoxxHoH1tYOREsQ22OKDYofGebrNm6CTPUcvLvZm63NL/vzCYdjf9CUhqmA==",
"requires": {
"history": "^5.2.0",
"react-router": "6.2.1"
}
},
"react-scripts": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-4.0.3.tgz",
......@@ -8,9 +8,11 @@
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"axios": "^0.24.0",
"history": "^5.2.0",
"js-cookie": "^3.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^6.2.1",
"react-scripts": "4.0.3",
"validator": "^13.7.0",
"web-vitals": "^1.0.1"
......
......@@ -6,7 +6,7 @@ import MyTickets from '../Pages/MyTickets';
import Marketplace from '../Pages/Marketplace';
import NavBar from './NavBar';
import NotFound from '../Pages/NotFound'
import { BrowserRouter, Switch, Route} from 'react-router-dom'
import { BrowserRouter, Route, Routes} from 'react-router-dom'
import SignUp from '../Pages/SignUp';
import ForgotPassword from '../Pages/ForgotPassword';
......@@ -15,32 +15,15 @@ function App() {
<>
<BrowserRouter>
<NavBar />
<Switch>
<Route exact path='/'>
<Marketplace />
</Route>
<Route exact path='/Marketplace'>
<Marketplace />
</Route>
<Route exact path='/CreateEvent'>
<CreateEvent />
</Route>
<Route exact path='/MyTickets'>
<MyTickets />
</Route>
<Route exact path='/Login'>
<Login />
</Route>
<Route exact path='/SignUp'>
<SignUp />
</Route>
<Route exact path='/ForgotPassword'>
<ForgotPassword />
</Route>
<Route>
<NotFound />
</Route>
</Switch>
<Routes>
<Route exact path="/Marketplace" element={<Marketplace />} />
<Route exact path="/CreateEvent" element={<CreateEvent />} />
<Route exact path="/MyTickets" element={<MyTickets />} />
<Route exact path="/Login" element={<Login />} />
<Route exact path="/SignUp" element={<SignUp />} />
<Route exact path="/ForgotPassword" element={<ForgotPassword />} />
<Route path="*" element={<NotFound />} />
</Routes>
</BrowserRouter>
</>
);
......
import React, { useState } from "react";
import { Link, useHistory } from 'react-router-dom';
import { Link, useNavigate } from 'react-router-dom';
import errorAlert from '../Helpers/errorAlert';
import isEmpty from 'validator/lib/isEmpty';
import isEmail from 'validator/lib/isEmail';
......@@ -8,6 +8,8 @@ import { isAuthenticated, setAuthentication } from "../Helpers/auth";
const LoginForm = () => {
let navigate = useNavigate()
const[formData, setFormData] = useState({
email: 'user@gmail.com',
password: 'password123',
......@@ -47,7 +49,7 @@ const LoginForm = () => {
if (isAuthenticated()) {
console.log("User is authenticated")
navigate("/Marketplace")
}
})
......
......@@ -4,7 +4,7 @@ import { Link } from 'react-router-dom';
const NavBar = () => {
return (
<nav className='flex justify-between items-center pt-5 h-20 '>
<Link to='/' className='font-montserrat font-extrabold pl-20 text-2xl'>Tickcrypt</Link>
<Link to='/Marketplace' className='font-montserrat font-extrabold pl-20 text-2xl'>Tickcrypt</Link>
<div className='px-4 cursor-pointer md:hidden'>
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 8h16M4 16h16" /></svg>
</div>
......
......@@ -1007,7 +1007,7 @@
"core-js-pure" "^3.0.0"
"regenerator-runtime" "^0.13.4"
"@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4":
"@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4":
"resolved" "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.18.tgz"
"version" "7.12.18"
dependencies:
......@@ -5047,6 +5047,13 @@
"resolved" "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz"
"version" "1.1.0"
"history@^5.2.0":
"integrity" "sha512-uPSF6lAJb3nSePJ43hN3eKj1dTWpN9gMod0ZssbFTIsen+WehTmEadgL+kg78xLJFdRfrrC//SavDzmRVdE+Ig=="
"resolved" "https://registry.npmjs.org/history/-/history-5.2.0.tgz"
"version" "5.2.0"
dependencies:
"@babel/runtime" "^7.7.6"
"hmac-drbg@^1.0.1":
"resolved" "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz"
"version" "1.0.1"
......@@ -8391,7 +8398,7 @@
"strip-ansi" "6.0.0"
"text-table" "0.2.0"
"react-dom@*", "react-dom@^17.0.2":
"react-dom@*", "react-dom@^17.0.2", "react-dom@>=16.8":
"resolved" "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz"
"version" "17.0.2"
dependencies:
......@@ -8415,6 +8422,21 @@
"resolved" "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz"
"version" "0.8.3"
"react-router-dom@^6.2.1":
"integrity" "sha512-I6Zax+/TH/cZMDpj3/4Fl2eaNdcvoxxHoH1tYOREsQ22OKDYofGebrNm6CTPUcvLvZm63NL/vzCYdjf9CUhqmA=="
"resolved" "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.2.1.tgz"
"version" "6.2.1"
dependencies:
"history" "^5.2.0"
"react-router" "6.2.1"
"react-router@6.2.1":
"integrity" "sha512-2fG0udBtxou9lXtK97eJeET2ki5//UWfQSl1rlJ7quwe6jrktK9FCCc8dQb5QY6jAv3jua8bBQRhhDOM/kVRsg=="
"resolved" "https://registry.npmjs.org/react-router/-/react-router-6.2.1.tgz"
"version" "6.2.1"
dependencies:
"history" "^5.2.0"
"react-scripts@^4.0.0", "react-scripts@4.0.3":
"resolved" "https://registry.npmjs.org/react-scripts/-/react-scripts-4.0.3.tgz"
"version" "4.0.3"
......@@ -8480,7 +8502,7 @@
optionalDependencies:
"fsevents" "^2.1.3"
"react@*", "react@^17.0.2", "react@>= 16", "react@17.0.2":
"react@*", "react@^17.0.2", "react@>= 16", "react@>=16.8", "react@17.0.2":
"resolved" "https://registry.npmjs.org/react/-/react-17.0.2.tgz"
"version" "17.0.2"
dependencies:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment