fix navigation

This commit is contained in:
mark 2025-05-28 09:52:10 +08:00
parent 4d7a9492bc
commit a6923e8c3c
5 changed files with 18 additions and 32 deletions

7
.env
View File

@ -1,6 +1 @@
# .env VITE_API_URL=http://127.0.0.1:8000
VITE_API_URL=http://localhost:8000
# You can also create environment-specific files:
# .env.development
# .env.production

View File

@ -108,16 +108,9 @@ export default function UserCreate() {
<main className="p-4 md:p-6"> <main className="p-4 md:p-6">
<div className="mb-6"> <div className="mb-6">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Button
variant="ghost"
size="icon"
onClick={() => navigate("/admin/dashboard")}
className="hover:bg-gray-800 text-gray-400 hover:text-white">
<ArrowLeft className="size-5" />
</Button>
<h1 className="text-2xl md:text-3xl font-serif font-bold text-white">Account Settings</h1> <h1 className="text-2xl md:text-3xl font-serif font-bold text-white">Account Settings</h1>
</div> </div>
<p className="text-gray-400 mt-2 ml-10">Manage your profile and security preferences</p> <p className="text-gray-400 mt-2">Manage your profile and security preferences</p>
</div> </div>
{/* Current user information card */} {/* Current user information card */}

View File

@ -70,16 +70,9 @@ export default function UserCreate() {
<main className="p-4 md:p-6"> <main className="p-4 md:p-6">
<div className="mb-6"> <div className="mb-6">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<Button
variant="ghost"
size="icon"
onClick={() => navigate("/admin/settings")}
className="hover:bg-gray-800 text-gray-400 hover:text-white">
<ArrowLeft className="size-5" />
</Button>
<h1 className="text-2xl md:text-3xl font-serif font-bold text-white">Create New User</h1> <h1 className="text-2xl md:text-3xl font-serif font-bold text-white">Create New User</h1>
</div> </div>
<p className="text-gray-400 mt-2 ml-10">Add a new administrator to the system</p> <p className="text-gray-400 mt-2">Add a new administrator to the system</p>
</div> </div>
<div className="max-w-10xl mx-auto"> <div className="max-w-10xl mx-auto">

View File

@ -421,22 +421,22 @@ export default function Home() {
> >
Search Database Search Database
</Link> </Link>
<Link to="/contribute" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors"> <Link to="#" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors">
Contribute a Story Contribute a Story
</Link> </Link>
<Link to="/gallery" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors"> <Link to="/" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors">
Photo Gallery Photo Gallery
</Link> </Link>
<Link <Link
to="/research-help" to="/"
className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors"
> >
Research Help Research Help
</Link> </Link>
<Link to="/volunteer" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors"> <Link to="/" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors">
Volunteer Volunteer
</Link> </Link>
<Link to="/donations" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors"> <Link to="/" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors">
Support Us Support Us
</Link> </Link>
</nav> </nav>
@ -446,22 +446,22 @@ export default function Home() {
<div className="space-y-4"> <div className="space-y-4">
<h3 className="text-lg font-bold font-serif text-[#E8DCCA]">Resources</h3> <h3 className="text-lg font-bold font-serif text-[#E8DCCA]">Resources</h3>
<nav className="space-y-2"> <nav className="space-y-2">
<Link to="/faq" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors"> <Link to="/" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors">
FAQ FAQ
</Link> </Link>
<Link <Link
to="/research-guides" to="/"
className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors"
> >
Research Guides Research Guides
</Link> </Link>
<Link <Link
to="/historical-timeline" to="/"
className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors"
> >
Historical Timeline Historical Timeline
</Link> </Link>
<Link to="/partnerships" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors"> <Link to="/" className="block text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors">
Partnerships Partnerships
</Link> </Link>
</nav> </nav>
@ -556,7 +556,7 @@ export default function Home() {
<a href="#" className="text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors"> <a href="#" className="text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors">
Accessibility Accessibility
</a> </a>
<a href="#" className="text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors"> <a href="/login" className="text-sm text-gray-300 hover:text-[#E8DCCA] transition-colors">
Admin Admin
</a> </a>
</nav> </nav>

View File

@ -37,6 +37,10 @@ class ApiService {
// --- AUTH --- // --- AUTH ---
async login(params: { email: string; password: string }) { async login(params: { email: string; password: string }) {
// First get CSRF cookie
await this.api.get("/sanctum/csrf-cookie");
// Then login
return this.api.post("/api/login", params).then((res) => { return this.api.post("/api/login", params).then((res) => {
console.log("Token:", res.data.token); console.log("Token:", res.data.token);
localStorage.setItem("token", res.data.token); localStorage.setItem("token", res.data.token);
@ -45,6 +49,7 @@ class ApiService {
}); });
} }
async register(params: { name: string; email: string; password: string }) { async register(params: { name: string; email: string; password: string }) {
return this.api.post("/api/register", params).then((res) => res.data); return this.api.post("/api/register", params).then((res) => res.data);