Skip to content

Commit b25a444

Browse files
authored
Merge pull request #53 from Nilanth/codex/upgrade-dependencies-to-latest-major-version
chore: upgrade backend and frontend dependencies to latest major lines
2 parents a2a13f8 + 3e7b299 commit b25a444

7 files changed

Lines changed: 10062 additions & 7037 deletions

File tree

app/Http/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Kernel extends HttpKernel
1616
protected $middleware = [
1717
// \App\Http\Middleware\TrustHosts::class,
1818
\App\Http\Middleware\TrustProxies::class,
19-
\Fruitcake\Cors\HandleCors::class,
19+
\Illuminate\Http\Middleware\HandleCors::class,
2020
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
2121
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
2222
\App\Http\Middleware\TrimStrings::class,

composer.json

100755100644
Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"minimum-stability": "dev",
1313
"keywords": [
1414
"laravel",
15-
"laravel-8",
15+
"laravel-12",
1616
"react",
1717
"react-redux",
1818
"redux",
@@ -27,21 +27,18 @@
2727
"larave-react-redux"
2828
],
2929
"require": {
30-
"php": "^7.3|^8.0",
31-
"fruitcake/laravel-cors": "^2.0",
32-
"guzzlehttp/guzzle": "^7.0.1",
33-
"laravel/framework": "^9.0",
34-
"laravel/sanctum": "^2.9",
35-
"laravel/tinker": "^2.5",
36-
"laravel/ui": "^3.2"
30+
"php": "^8.2",
31+
"guzzlehttp/guzzle": "^7.9",
32+
"laravel/framework": "^12.0",
33+
"laravel/sanctum": "^4.0",
34+
"laravel/tinker": "^2.10"
3735
},
3836
"require-dev": {
39-
"spatie/laravel-ignition": "^1.0",
40-
"fakerphp/faker": "^1.9.1",
41-
"laravel/sail": "^1.0.1",
42-
"mockery/mockery": "^1.4.2",
43-
"nunomaduro/collision": "^6.1",
44-
"phpunit/phpunit": "^9.3.3"
37+
"fakerphp/faker": "^1.24",
38+
"laravel/sail": "^1.40",
39+
"mockery/mockery": "^1.6",
40+
"nunomaduro/collision": "^8.0",
41+
"phpunit/phpunit": "^11.5"
4542
},
4643
"config": {
4744
"optimize-autoloader": true,

package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@
1010
"production": "mix --production"
1111
},
1212
"devDependencies": {
13-
"@babel/preset-react": "^7.0.0",
14-
"eslint": "^7.20.0",
15-
"laravel-mix": "^6.0.6",
16-
"postcss": "^8.1.14",
17-
"resolve-url-loader": "^3.1.2"
13+
"@babel/preset-react": "^7.28.5",
14+
"eslint": "^9.36.0",
15+
"laravel-mix": "^6.0.49",
16+
"postcss": "^8.5.6",
17+
"resolve-url-loader": "^5.0.0"
1818
},
1919
"dependencies": {
20-
"@ant-design/icons": "^4.4.0",
21-
"@babel/eslint-parser": "^7.12.16",
22-
"@reduxjs/toolkit": "^1.5.0",
23-
"antd": "^4.12.2",
24-
"axios": "^0.28.0",
25-
"react": "^18.2.0",
26-
"react-dom": "^18.2.0",
27-
"react-redux": "^7.2.2",
28-
"react-router-dom": "^5.2.0",
29-
"redux-saga": "^1.1.3",
30-
"sass": "^1.32.6",
31-
"sass-loader": "^11.0.0"
20+
"@ant-design/icons": "^6.1.0",
21+
"@babel/eslint-parser": "^7.28.4",
22+
"@reduxjs/toolkit": "^2.9.0",
23+
"antd": "^5.27.1",
24+
"axios": "^1.11.0",
25+
"react": "^19.1.1",
26+
"react-dom": "^19.1.1",
27+
"react-redux": "^9.2.0",
28+
"react-router-dom": "^7.9.1",
29+
"redux-saga": "^1.4.2",
30+
"sass": "^1.92.1",
31+
"sass-loader": "^16.0.5"
3232
}
3333
}

resources/js/routes/AppRoutes.js

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,49 @@
11
import {lazy, Suspense} from 'react';
2-
import {BrowserRouter as Router, Switch} from 'react-router-dom';
2+
import {BrowserRouter as Router, Route, Routes} from 'react-router-dom';
33
import {PrivateRoute, PublicRoute} from '../routes/helpers';
44
import ProtectedRoutes from '../routes/ProtectedRoutes';
55

66
const LoginPage = lazy(() => import('../components/LoginPage'));
77
const Registration = lazy(() => import('../components/Register'));
88

9-
109
export function AppRoutes({isAuthenticated}) {
1110
return (
1211
<Router>
1312
<Suspense fallback={<div>Loading...</div>}>
14-
<Switch>
15-
<PublicRoute path="/" isAuthenticated={isAuthenticated} exact>
16-
<LoginPage/>
17-
</PublicRoute>
18-
<PublicRoute path="/login" isAuthenticated={isAuthenticated} exact>
19-
<LoginPage/>
20-
</PublicRoute>
21-
<PublicRoute path="/register" isAuthenticated={isAuthenticated} exact>
22-
<Registration/>
23-
</PublicRoute>
24-
<PrivateRoute path="/" isAuthenticated={isAuthenticated} >
25-
<ProtectedRoutes/>
26-
</PrivateRoute>
27-
</Switch>
13+
<Routes>
14+
<Route
15+
path="/"
16+
element={
17+
<PublicRoute isAuthenticated={isAuthenticated}>
18+
<LoginPage/>
19+
</PublicRoute>
20+
}
21+
/>
22+
<Route
23+
path="/login"
24+
element={
25+
<PublicRoute isAuthenticated={isAuthenticated}>
26+
<LoginPage/>
27+
</PublicRoute>
28+
}
29+
/>
30+
<Route
31+
path="/register"
32+
element={
33+
<PublicRoute isAuthenticated={isAuthenticated}>
34+
<Registration/>
35+
</PublicRoute>
36+
}
37+
/>
38+
<Route
39+
path="/*"
40+
element={
41+
<PrivateRoute isAuthenticated={isAuthenticated}>
42+
<ProtectedRoutes/>
43+
</PrivateRoute>
44+
}
45+
/>
46+
</Routes>
2847
</Suspense>
2948
</Router>
3049
);

resources/js/routes/ProtectedRoutes.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Here we include the components which need to be accesses after successful login.
2-
import {Route, Switch} from 'react-router-dom';
2+
import {Route, Routes} from 'react-router-dom';
33
import {Button, Layout} from 'antd';
44
import {useDispatch, useSelector} from 'react-redux';
55
import {LoginOutlined} from '@ant-design/icons';
@@ -9,15 +9,16 @@ import routes from './routes';
99
const {Header, Content} = Layout;
1010

1111
function ProtectedRoutes() {
12-
const {name, logOutLoader} = useSelector(state => state.authenticateReducer)
12+
const {name, logOutLoader} = useSelector(state => state.authenticateReducer);
1313

1414
const dispatch = useDispatch();
1515

16-
let onLogout = () => {
16+
const onLogout = () => {
1717
dispatch({
1818
type: actions.LOGOUT,
1919
});
2020
};
21+
2122
return (
2223
<Layout className="layout">
2324
<Header>
@@ -33,13 +34,11 @@ function ProtectedRoutes() {
3334
</div>
3435
</Header>
3536
<Content style={{padding: '0 50px'}}>
36-
<Switch>
37-
{routes.map(({component: Component, path, exact}, index) => (
38-
<Route path={`/${path}`} key={index} exact={exact}>
39-
<Component/>
40-
</Route>
37+
<Routes>
38+
{routes.map(({component: Component, path}, index) => (
39+
<Route path={path} key={index} element={<Component/>}/>
4140
))}
42-
</Switch>
41+
</Routes>
4342
</Content>
4443
</Layout>
4544
);

resources/js/routes/helpers.js

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,35 @@
11
// Private route restrict to access public pages after login.
2-
import {Redirect, Route} from 'react-router-dom';
2+
import {Navigate, useLocation} from 'react-router-dom';
3+
4+
export function PrivateRoute({children, isAuthenticated}) {
5+
const location = useLocation();
6+
7+
if (isAuthenticated) {
8+
return children;
9+
}
310

4-
export function PrivateRoute({children, isAuthenticated, ...rest}) {
511
return (
6-
<Route
7-
{...rest}
8-
render={({location}) =>
9-
(isAuthenticated ? (
10-
children
11-
) : (
12-
<Redirect
13-
to={{
14-
pathname: '/login',
15-
state: {from: location},
16-
}}
17-
/>
18-
))
19-
}
12+
<Navigate
13+
to="/login"
14+
replace
15+
state={{from: location}}
2016
/>
2117
);
2218
}
2319

2420
// Public route restrict to access authenticated pages before login.
25-
export function PublicRoute({children, isAuthenticated, ...rest}) {
21+
export function PublicRoute({children, isAuthenticated}) {
22+
const location = useLocation();
23+
24+
if (!isAuthenticated) {
25+
return children;
26+
}
27+
2628
return (
27-
<Route
28-
{...rest}
29-
render={
30-
({location}) =>
31-
(!isAuthenticated ? (
32-
children
33-
) : (
34-
<Redirect
35-
to={{
36-
pathname: '/dashboard',
37-
state: {from: location},
38-
}}
39-
/>
40-
))
41-
}
29+
<Navigate
30+
to="/dashboard"
31+
replace
32+
state={{from: location}}
4233
/>
4334
);
4435
}

0 commit comments

Comments
 (0)