diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-08-01 17:49:26 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-08-01 17:49:26 +0530 |
commit | bd933a5aace3ac4944bfe7f4b58b4908978b4950 (patch) | |
tree | b738f4c68d897c009ba7823d0e99f1f6b44a611d /src/pages | |
parent | fb04271b5288e8fb5891b7d6326f4806d12b82d5 (diff) | |
download | admin-panel-bd933a5aace3ac4944bfe7f4b58b4908978b4950.tar.gz admin-panel-bd933a5aace3ac4944bfe7f4b58b4908978b4950.tar.bz2 admin-panel-bd933a5aace3ac4944bfe7f4b58b4908978b4950.zip |
merge
Diffstat (limited to 'src/pages')
-rw-r--r-- | src/pages/Dashboard.jsx | 14 | ||||
-rw-r--r-- | src/pages/Login.jsx | 46 | ||||
-rw-r--r-- | src/pages/ManageAds.jsx | 53 | ||||
-rw-r--r-- | src/pages/Register.jsx | 43 |
4 files changed, 0 insertions, 156 deletions
diff --git a/src/pages/Dashboard.jsx b/src/pages/Dashboard.jsx deleted file mode 100644 index ce3472e..0000000 --- a/src/pages/Dashboard.jsx +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -import Navbar from '../components/Navbar'; - -const Dashboard = () => { - return ( - <div> - <Navbar /> - <h1>Dashboard</h1> - {/* Add dashboard content here */} - </div> - ); -}; - -export default Dashboard; diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx deleted file mode 100644 index 9d38aa9..0000000 --- a/src/pages/Login.jsx +++ /dev/null @@ -1,46 +0,0 @@ -import React, { useState } from 'react'; -import axios from 'axios'; -import { useNavigate } from 'react-router-dom'; - -const Login = () => { - const [username, setUsername] = useState(''); - const [password, setPassword] = useState(''); - const navigate = useNavigate(); - - const handleLogin = async (e) => { - e.preventDefault(); - try { - const response = await axios.post('http://localhost:5000/login', { - username, - password, - }); - localStorage.setItem('token', response.data.token); - navigate('/dashboard'); - } catch (error) { - console.error(error); - } - }; - - return ( - <div> - <h1>Login</h1> - <form onSubmit={handleLogin}> - <input - type="text" - placeholder="Username" - value={username} - onChange={(e) => setUsername(e.target.value)} - /> - <input - type="password" - placeholder="Password" - value={password} - onChange={(e) => setPassword(e.target.value)} - /> - <button type="submit">Login</button> - </form> - </div> - ); -}; - -export default Login; diff --git a/src/pages/ManageAds.jsx b/src/pages/ManageAds.jsx deleted file mode 100644 index cceca06..0000000 --- a/src/pages/ManageAds.jsx +++ /dev/null @@ -1,53 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import AdCard from '../components/AdCard'; -import UploadForm from '../components/UploadForm'; -import ViewAds from '../components/ViewAds'; -import { fetchAds, addAd } from '../utils/api'; - -const ManageAds = () => { - const [ads, setAds] = useState([]); - const [showUploadedAds, setShowUploadedAds] = useState(false); - const [uploadedUrls, setUploadedUrls] = useState([]); - - useEffect(() => { - const getAds = async () => { - const adsData = await fetchAds(); - setAds(adsData); - }; - getAds(); - }, []); - - const handleAddAd = async (ad) => { - await addAd(ad); - setAds([...ads, ad]); - }; - - const toggleViewAds = () => { - setShowUploadedAds(!showUploadedAds); - }; - - const handleUploadComplete = (url) => { - setUploadedUrls([...uploadedUrls, url]); - }; - - return ( - <div> - <h1>Manage Ads</h1> - <UploadForm onUploadComplete={handleUploadComplete} /> - <button onClick={toggleViewAds}> - {showUploadedAds ? 'Hide Uploaded Ads' : 'View Uploaded Ads'} - </button> - {showUploadedAds ? ( - <ViewAds /> - ) : ( - <div> - {ads.map((ad) => ( - <AdCard key={ad.id} ad={ad} /> - ))} - </div> - )} - </div> - ); -}; - -export default ManageAds; diff --git a/src/pages/Register.jsx b/src/pages/Register.jsx deleted file mode 100644 index f0acf58..0000000 --- a/src/pages/Register.jsx +++ /dev/null @@ -1,43 +0,0 @@ -import React, { useState } from 'react'; -import axios from 'axios'; - -const Register = () => { - const [username, setUsername] = useState(''); - const [password, setPassword] = useState(''); - - const handleRegister = async (e) => { - e.preventDefault(); - try { - const response = await axios.post('http://localhost:5000/register', { - username, - password, - }); - console.log(response.data); - } catch (error) { - console.error(error); - } - }; - - return ( - <div> - <h1>Register</h1> - <form onSubmit={handleRegister}> - <input - type="text" - placeholder="Username" - value={username} - onChange={(e) => setUsername(e.target.value)} - /> - <input - type="password" - placeholder="Password" - value={password} - onChange={(e) => setPassword(e.target.value)} - /> - <button type="submit">Register</button> - </form> - </div> - ); -}; - -export default Register; |