node -v (v21.0.0)
npm -v (v10.2.0)
npx create-react-app reactecom
cd reactecom
npm start
npm install react-router-dom
npm install axios
npm install bootstrap@5.3.2
npm install sweetalert --save
Usage:
import swal from 'sweetalert';
swal("Hello world!");
CSRF Protection:To authenticate your SPA, your SPA's "login" page should first make a request to the /sanctum/csrf-cookie endpoint to initialize CSRF protection for the application:
axios.get('/sanctum/csrf-cookie').then(response => {
axios.post(`${constant.url}/api/register`, data).then((res) => {
});
});
📂 src
📂 assets
📂 admin
📁 assets
📁 css
📁 javascript
📂 frontend
📂 components
📂 admin
🗏 Dashboard.js
🗏 Profile.js
📂 Frontend
📂 auth
🗏 Login.js
🗏 Register.js
🗏 Home.js
📂 layouts
📂 admin
🗏 Footer.js
🗏 MasterLayout.js
🗏 Navbar.js
🗏 Sidebar.js
📂 frontend
🗏 Navbar.js
📂 routes
🗏 Routes.js
if your are facing this error, you should add in your .env
file.
SESSION_DOMAIN=localhost
SANCTUM_STATEFUL_DOMAINS=localhost