wpNonceVerify method

Future<WPNonceVerifiedResponse> wpNonceVerify({
  1. required String nonce,
})

Sends a request to check if a given nonce value is still valid.

Returns a WPNonceVerifiedResponse future. Throws an Exception if fails

Implementation

Future<WPNonceVerifiedResponse> wpNonceVerify({required String nonce}) async {
  Map<String, dynamic> payload = {"nonce": nonce};

  // send http request
  final json = await _http(
    method: "POST",
    url: _urlForRouteType(WPRouteType.AuthVerify),
    body: payload,
  );

  // return response
  return _jsonHasBadStatus(json)
      ? this._throwExceptionForStatusCode(json)
      : WPNonceVerifiedResponse.fromJson(json);
}