refreshToken method

Future<JwtToken> refreshToken(
  1. String username,
  2. String refreshToken
)

Implementation

Future<JwtToken> refreshToken(String username, String refreshToken) async {
  var response = await dio.post(
    config.refreshUrl,
    data: {
      'username': username,
      'refreshToken': refreshToken,
    },
  );

  if (response.statusCode == 200) {
    var jwtToken =
        JwtToken.fromJson(jsonDecode(response.data) as Map<String, dynamic>);
    // _setToken(_jwtToken!);
    return jwtToken;
  } else {
    // var error = _handleError(response);
    throw Exception(response.data);
  }
}