admin 26-5-2
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:sefer_admin1/constant/links.dart';
|
||||
import 'package:sefer_admin1/controller/functions/crud.dart';
|
||||
import 'package:sefer_admin1/controller/auth/otp_helper.dart';
|
||||
|
||||
import '../../constant/api_key.dart';
|
||||
import '../../constant/box_name.dart';
|
||||
@@ -25,6 +26,19 @@ class DashboardController extends GetxController {
|
||||
var res = await CRUD().get(link: AppLink.getdashbord, payload: {});
|
||||
print('📡 Main dashboard response: $res');
|
||||
|
||||
if (res == 'token_expired') {
|
||||
print('❌ Admin token expired. Attempting seamless auto-login.');
|
||||
box.remove(BoxName.jwt);
|
||||
try {
|
||||
final otpHelper = Get.put(OtpHelper());
|
||||
await otpHelper.checkAdminLogin();
|
||||
} catch (e) {
|
||||
Get.offAllNamed('/login');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (res != 'failure' && res != null) {
|
||||
try {
|
||||
var d = res is String ? jsonDecode(res) : res;
|
||||
|
||||
Reference in New Issue
Block a user