Version OK

This commit is contained in:
dahoud
2025-10-05 14:26:15 +00:00
parent 291847924c
commit 8cec643361
7 changed files with 77 additions and 100 deletions

View File

@@ -38,8 +38,12 @@ class DioClient {
onRequest: (options, handler) async {
// Ajouter le token d'authentification si disponible
final token = await _secureStorage.read(key: 'keycloak_webview_access_token');
print('🔑 Token: ${token != null ? "EXISTS (${token.length} chars)" : "NULL"}');
if (token != null) {
options.headers['Authorization'] = 'Bearer $token';
print('✅ Authorization header added');
} else {
print('❌ No token available');
}
handler.next(options);
},
@@ -63,17 +67,17 @@ class DioClient {
},
));
// Logger pour le développement (désactivé en production)
// _dio.interceptors.add(
// LogInterceptor(
// requestHeader: true,
// requestBody: true,
// responseBody: true,
// responseHeader: false,
// error: true,
// logPrint: (obj) => print('DIO: $obj'),
// ),
// );
// Logger pour le développement
_dio.interceptors.add(
LogInterceptor(
requestHeader: true,
requestBody: true,
responseBody: true,
responseHeader: false,
error: true,
logPrint: (obj) => print('🔵 DIO: $obj'),
),
);
}
/// Rafraîchit le token d'authentification

View File

@@ -61,7 +61,7 @@ enum PrioriteEvenement {
@JsonSerializable()
class EvenementModel extends Equatable {
/// Identifiant unique
final String? id;
final int? id;
/// Titre de l'événement
final String titre;
@@ -106,7 +106,7 @@ class EvenementModel extends Equatable {
/// ID de l'organisateur
@JsonKey(name: 'organisateurId')
final String? organisateurId;
final int? organisateurId;
/// Nom de l'organisateur (pour affichage)
@JsonKey(name: 'organisateurNom')
@@ -114,7 +114,7 @@ class EvenementModel extends Equatable {
/// ID de l'organisation
@JsonKey(name: 'organisationId')
final String? organisationId;
final int? organisationId;
/// Nom de l'organisation (pour affichage)
@JsonKey(name: 'organisationNom')
@@ -203,7 +203,7 @@ class EvenementModel extends Equatable {
/// Copie avec modifications
EvenementModel copyWith({
String? id,
int? id,
String? titre,
String? description,
DateTime? dateDebut,
@@ -216,9 +216,9 @@ class EvenementModel extends Equatable {
StatutEvenement? statut,
int? maxParticipants,
int? participantsActuels,
String? organisateurId,
int? organisateurId,
String? organisateurNom,
String? organisationId,
int? organisationId,
String? organisationNom,
PrioriteEvenement? priorite,
bool? estPublic,

View File

@@ -8,7 +8,7 @@ part of 'evenement_model.dart';
EvenementModel _$EvenementModelFromJson(Map<String, dynamic> json) =>
EvenementModel(
id: json['id'] as String?,
id: (json['id'] as num?)?.toInt(),
titre: json['titre'] as String,
description: json['description'] as String?,
dateDebut: DateTime.parse(json['dateDebut'] as String),
@@ -23,9 +23,9 @@ EvenementModel _$EvenementModelFromJson(Map<String, dynamic> json) =>
StatutEvenement.planifie,
maxParticipants: (json['maxParticipants'] as num?)?.toInt(),
participantsActuels: (json['participantsActuels'] as num?)?.toInt() ?? 0,
organisateurId: json['organisateurId'] as String?,
organisateurId: (json['organisateurId'] as num?)?.toInt(),
organisateurNom: json['organisateurNom'] as String?,
organisationId: json['organisationId'] as String?,
organisationId: (json['organisationId'] as num?)?.toInt(),
organisationNom: json['organisationNom'] as String?,
priorite:
$enumDecodeNullable(_$PrioriteEvenementEnumMap, json['priorite']) ??