updated admin panel error where reload kicks you out

This commit is contained in:
nvrl committed 2026-02-18 13:49:53 +01:00
1 parent dcafd3aa53
commit 1dfdf694ce
2 files changed
+23 -1

No files matched your search

+9 -1
View File
@@ -5,12 +5,16 @@ from rest_framework.authtoken.views import obtain_auth_token
from django.conf import settings
from django.conf.urls.static import static
from django.views.static import serve
from django.views.generic.base import TemplateView
from django.views.static import serve
from django.conf import settings
import os
# Clean the admin path
admin_url = os.environ.get('ADMIN_URL', 'admin').strip('/')
def serve_index(request, resource=None):
return serve(request, 'index.html', document_root=settings.STATIC_ROOT)
urlpatterns = [
# Robots.txt
path('robots.txt', TemplateView.as_view(template_name="robots.txt", content_type="text/plain")),
@@ -24,4 +28,8 @@ urlpatterns = [
path('api/schema/swagger-ui/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
path('api/schema/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'),
path('media/<path:path>', serve, {'document_root': settings.MEDIA_ROOT}),
# Catch-all for React Frontend
path('', serve_index, name='index'),
path('<path:resource>', serve_index),
]
+14
View File
@@ -274,6 +274,19 @@ const AdminDashboard: React.FC = () => {
{currentTab === 2 && (
<Box>
<Typography variant="h5" sx={{ fontWeight: 'bold', mb: 3 }}>{t('admin.banners')}</Typography>
{banners.length === 0 ? (
<Card variant="outlined" sx={{ p: 4, textAlign: 'center', borderRadius: 3 }}>
<Typography color="text.secondary">No banner models found in the database.</Typography>
<Button
variant="outlined"
sx={{ mt: 2 }}
onClick={fetchData}
>
Retry Loading
</Button>
</Card>
) : (
<Grid container spacing={3}>
{banners.map((banner) => (
<Grid size={{ xs: 12, md: 4 }} key={banner.id}>
@@ -325,6 +338,7 @@ const AdminDashboard: React.FC = () => {
</Grid>
))}
</Grid>
)}
</Box>
)}