FEAT: Enhance authentication session management with configurable cookie domain and improved token refresh logic

This commit is contained in:
2025-06-16 17:53:43 +02:00
parent 3a83831a20
commit d436367ee6
11 changed files with 594 additions and 149 deletions

View File

@@ -655,6 +655,7 @@ import {
Deposit10PercentStatusFlow,
ContractStatusFlow,
} from "@/utils/types";
import { formatDate } from "@/utils/dateUtils";
interface Props {
modelValue: boolean;
@@ -1138,54 +1139,6 @@ const updateBerthRecommendations = async (newRecommendations: number[]) => {
}
};
// Format date helper function
const formatDate = (dateString: string | null | undefined) => {
if (!dateString) return "";
try {
let date: Date;
// Check if it's an ISO date string (e.g., "2025-06-09T22:58:47.731Z")
if (dateString.includes('T') || dateString.includes('Z')) {
date = new Date(dateString);
}
// Handle DD-MM-YYYY format
else if (dateString.match(/^\d{2}-\d{2}-\d{4}$/)) {
const [day, month, year] = dateString.split("-");
date = new Date(parseInt(year), parseInt(month) - 1, parseInt(day));
}
// Handle YYYY-MM-DD format
else if (dateString.match(/^\d{4}-\d{2}-\d{2}$/)) {
date = new Date(dateString);
}
// Fallback to direct parsing
else {
date = new Date(dateString);
}
// Check if date is valid
if (isNaN(date.getTime())) {
return dateString;
}
// Format date in DD/MM/YYYY HH:mm format
const day = date.getDate().toString().padStart(2, '0');
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const year = date.getFullYear();
const hours = date.getHours().toString().padStart(2, '0');
const minutes = date.getMinutes().toString().padStart(2, '0');
// Include time if it's not midnight
if (hours !== '00' || minutes !== '00') {
return `${day}/${month}/${year} ${hours}:${minutes}`;
}
return `${day}/${month}/${year}`;
} catch (error) {
console.error('Date formatting error:', error, dateString);
return dateString;
}
};
// Get color for sales level - matching InterestSalesBadge.vue
const getSalesLevelColor = (level: string) => {