feat: Enhance JWT authentication error logging, gate notification fetching by user status, and enable Rust debug logging in Docker Compose.
This commit is contained in:
@@ -23,6 +23,7 @@ services:
|
||||
DATABASE_URL: postgresql://user:password@db:5432/openccb_cms
|
||||
JWT_SECRET: ${JWT_SECRET:-openccb_secret_key_2025_production}
|
||||
NEXT_PUBLIC_CMS_API_URL: ${NEXT_PUBLIC_CMS_API_URL:-http://localhost:3001}
|
||||
RUST_LOG: debug
|
||||
LMS_INTERNAL_URL: http://experience:3002
|
||||
volumes:
|
||||
- uploads_data:/app/uploads
|
||||
@@ -45,6 +46,7 @@ services:
|
||||
environment:
|
||||
DATABASE_URL: postgresql://user:password@db:5432/openccb_lms
|
||||
JWT_SECRET: ${JWT_SECRET:-openccb_secret_key_2025_production}
|
||||
RUST_LOG: debug
|
||||
NEXT_PUBLIC_LMS_API_URL: ${NEXT_PUBLIC_LMS_API_URL:-http://localhost:3002}
|
||||
NEXT_PUBLIC_CMS_API_URL: ${NEXT_PUBLIC_CMS_API_URL:-http://localhost:3001}
|
||||
env_file: .env
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Invalid credentials
|
||||
@@ -1,10 +1,10 @@
|
||||
use axum::{
|
||||
extract::{FromRequestParts, Request},
|
||||
http::{request::Parts, StatusCode},
|
||||
http::{StatusCode, request::Parts},
|
||||
middleware::Next,
|
||||
response::Response,
|
||||
};
|
||||
use jsonwebtoken::{decode, DecodingKey, Validation};
|
||||
use jsonwebtoken::{DecodingKey, Validation, decode};
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::auth::Claims;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { lmsApi, Notification } from "@/lib/api";
|
||||
import { useAuth } from "@/context/AuthContext";
|
||||
import { Bell, X, Calendar, Info, AlertTriangle, CheckCircle2 } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
@@ -10,7 +11,10 @@ export default function NotificationCenter() {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const { user } = useAuth();
|
||||
|
||||
const fetchNotifications = async () => {
|
||||
if (!user) return;
|
||||
setLoading(true);
|
||||
try {
|
||||
const data = await lmsApi.getNotifications();
|
||||
@@ -23,11 +27,13 @@ export default function NotificationCenter() {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
fetchNotifications();
|
||||
// Poll every 5 minutes
|
||||
const interval = setInterval(fetchNotifications, 300000);
|
||||
return () => clearInterval(interval);
|
||||
}, []);
|
||||
if (user) {
|
||||
fetchNotifications();
|
||||
// Poll every 5 minutes
|
||||
const interval = setInterval(fetchNotifications, 300000);
|
||||
return () => clearInterval(interval);
|
||||
}
|
||||
}, [user]);
|
||||
|
||||
const markAsRead = async (id: string) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user