logout method

Future<bool> logout({
  1. required dynamic userId,
})

Implementation

Future<bool> logout({required userId}) async {
  final url = Uri.parse('${_wepinBaseUrl}user/$userId/logout');
  final response = await http.post(
    url,
    headers: headers,
  );

  if (response.statusCode >= 200 && response.statusCode < 300) {
    clearAuthToken();
    return true;
  } else {
    throw WepinError(WepinErrorCode.apiRequestError, 'code: ${response.statusCode} , body: ${response.body}');
  }
}