finishImpersonate method

Future finishImpersonate()

Implementation

Future finishImpersonate() async {
  try{
    //ripristino il vecchio token a prima dell'impersonificazione
    String? oldToken = await storage.read(key: KeyUtils.KEY_TOKEN_SESSION_BEFORE_IMPERSONATE);
    await storage.write(key: KeyUtils.KEY_TOKEN_SESSION, value: oldToken);
    await storage.delete(key: KeyUtils.KEY_TOKEN_SESSION_BEFORE_IMPERSONATE);
  }on Exception catch (e){
    print('BEA Finish Impersonate error');
    FLog.error(
        className: this.runtimeType.toString(),
        methodName: "finishImpersonate",
        text: 'BEA Finish Impersonate error - $e');
    throw e;
  }
}