fix: guest reload page to accessed MemberDashboard
This commit is contained in:
@@ -142,19 +142,21 @@ export const AddPhotoModal: React.FC<AddPhotoModalProps> = ({ isOpen, onClose, t
|
||||
setSelectedFiles([]);
|
||||
setPreviews([]);
|
||||
|
||||
// For public users: redirect to landing page after upload
|
||||
// For authenticated users: refresh tour data and close modal
|
||||
// Refresh tour data (applies to both authenticated and public users)
|
||||
// This ensures newly uploaded photos appear immediately without requiring a page reload
|
||||
fetchTour(tourId);
|
||||
if (onSuccess) onSuccess();
|
||||
|
||||
// For public users: redirect to landing page after upload (after data refresh)
|
||||
// For authenticated users: close modal and show updated tour
|
||||
if (isPublicView) {
|
||||
onClose();
|
||||
// Give time for notification to show before redirecting
|
||||
// Set flag so App.tsx knows to redirect to landing even if user is logged in
|
||||
// Give time for tour data to refresh before redirecting
|
||||
setTimeout(() => {
|
||||
localStorage.setItem('fromPublicUpload', 'true');
|
||||
window.location.href = '/';
|
||||
}, 1000);
|
||||
}, 1500);
|
||||
} else {
|
||||
fetchTour(tourId);
|
||||
if (onSuccess) onSuccess();
|
||||
onClose();
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user