Update site navigation and logout functionality
Refactors client-side navigation to use `wouter`'s `setLocation` instead of `window.location.href` for smoother transitions and improves the logout process by making it an asynchronous POST request with proper error handling and state invalidation. Also adds an "Auctions" button to the main navigation bar on multiple pages. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 069d4324-6c40-4355-955e-c714a50de1ea Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3df548ff-50ae-432f-9be4-25d34eccc983/069d4324-6c40-4355-955e-c714a50de1ea/bLfICpO
This commit is contained in:
@ -64,7 +64,7 @@ export default function MediaOutlet() {
|
||||
};
|
||||
|
||||
const handleAdminPage = () => {
|
||||
window.location.href = "/admin";
|
||||
setLocation("/admin");
|
||||
};
|
||||
|
||||
const formatCurrency = (amount: string | null) => {
|
||||
@ -150,14 +150,24 @@ export default function MediaOutlet() {
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setIsLoginModalOpen(true)}
|
||||
data-testid="button-login"
|
||||
>
|
||||
Login
|
||||
</Button>
|
||||
<>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setLocation("/auctions")}
|
||||
data-testid="button-auctions"
|
||||
>
|
||||
Auctions
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setIsLoginModalOpen(true)}
|
||||
data-testid="button-login"
|
||||
>
|
||||
Login
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
|
||||
<Button
|
||||
@ -194,7 +204,7 @@ export default function MediaOutlet() {
|
||||
<div className="text-center">
|
||||
<h1 className="text-2xl font-bold mb-2">Media Outlet Not Found</h1>
|
||||
<p className="text-gray-600 mb-4">The media outlet you're looking for doesn't exist.</p>
|
||||
<Button onClick={() => window.location.href = "/"}>Go to Homepage</Button>
|
||||
<Button onClick={() => setLocation("/")}>Go to Homepage</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@ -212,7 +222,7 @@ export default function MediaOutlet() {
|
||||
alt="SAPIENS"
|
||||
className="h-6 w-auto cursor-pointer"
|
||||
data-testid="logo-sapiens"
|
||||
onClick={() => window.location.href = "/"}
|
||||
onClick={() => setLocation("/")}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -235,6 +245,15 @@ export default function MediaOutlet() {
|
||||
|
||||
{isAuthenticated && user ? (
|
||||
<>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => setLocation("/auctions")}
|
||||
data-testid="button-auctions"
|
||||
>
|
||||
Auctions
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
|
||||
Reference in New Issue
Block a user