Remove notification system and fix data refresh issues
- Removed NotificationPanel component and related files - Removed notifications API endpoint and utils - Fixed data refresh functionality with cache-busting - Added refreshing state with better UI feedback - Added no-cache headers to API endpoint - Improved refresh button with loading state
This commit is contained in:
@ -1,5 +1,9 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
// Force dynamic rendering to prevent caching
|
||||
export const dynamic = 'force-dynamic';
|
||||
export const revalidate = 0;
|
||||
|
||||
// Library branch locations with approximate coordinates
|
||||
const LIBRARY_LOCATIONS: Record<string, { lat: number; lng: number }> = {
|
||||
'Beckwourth': { lat: 32.7157, lng: -117.1611 },
|
||||
@ -127,10 +131,17 @@ export async function GET() {
|
||||
|
||||
const locations = Array.from(locationMap.values());
|
||||
|
||||
return NextResponse.json({
|
||||
const response = NextResponse.json({
|
||||
locations,
|
||||
lastUpdated: new Date().toISOString(),
|
||||
});
|
||||
|
||||
// Prevent caching to ensure fresh data
|
||||
response.headers.set('Cache-Control', 'no-cache, no-store, must-revalidate');
|
||||
response.headers.set('Pragma', 'no-cache');
|
||||
response.headers.set('Expires', '0');
|
||||
|
||||
return response;
|
||||
} catch (error) {
|
||||
console.error('Error in API route:', error);
|
||||
return NextResponse.json(
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { NotificationManager } from '../../utils/notifications';
|
||||
|
||||
// This API endpoint can be used for periodic checking
|
||||
export async function GET() {
|
||||
try {
|
||||
const notifications = NotificationManager.getNotifications();
|
||||
|
||||
// In a real implementation, you might want to:
|
||||
// 1. Fetch current availability data
|
||||
// 2. Check against notification preferences
|
||||
// 3. Send email notifications
|
||||
// 4. Return results
|
||||
|
||||
return NextResponse.json({
|
||||
notificationCount: notifications.length,
|
||||
notifications: notifications.map(n => ({
|
||||
id: n.id,
|
||||
libraryName: n.libraryName,
|
||||
passTypes: n.passTypes,
|
||||
createdAt: n.createdAt,
|
||||
lastChecked: n.lastChecked,
|
||||
})),
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error checking notifications:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to check notifications' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user