@override Future onResponse(Response options) async {
final _logincontroller = Get.find<LoginController>();
final _secureStorage = Get.find<FlutterSecureStorage>();
final SharedSettingsService _sharedsettingsservice = Get.find<SharedSettingsService>();
switch (options.request.path) {
case apiAuthToken:
{
print('Token set update *******************************************');
String tokendata =
options.data['key'];
await _secureStorage.write(key: tokenKey, value: tokendata);
_sharedsettingsservice.token.value = tokendata;
Get.offAllNamed(rHOME);
}
break;
case apiAuthSignout:
{
print('Token reset update *******************************************');
await _secureStorage.delete(key: tokenKey);
// _logincontroller.token.value = '';
//
// Get.offAllNamed(rLOGIN);
}
break;
default:
{
print('Normal action *******************************************');
}
break;
}
return options;
// if (options.headers.value(token) != null) {
// //if the header is present, then compare it with the Shared Prefs key
// SharedPreferences prefs = await SharedPreferences.getInstance();
// var verifyToken = prefs.get(token);
//
// // if the value is the same as the header, continue with the request
// if (options.headers.value(token) == verifyToken) {
// return options;
// }
// }
//
// return DioError(request: options.request, error: "User is no longer active");
// }
}