diff --git a/src/account.ts b/src/account.ts index a1255bb..eeb62d1 100644 --- a/src/account.ts +++ b/src/account.ts @@ -6,6 +6,7 @@ import { OTPValidateRequest, OTPVerifyRequest, PasswordResetVerifyRequest, + PingResponse, postApiAuthPasswordResetRequest, postApiAuthPing, RegisterRequest, @@ -166,7 +167,14 @@ export default class AccountApi { } public async ping(): Promise { - return this.checkSuccessBool(await postApiAuthPing(this.buildOptions())); + let ret: AxiosResponse; + try { + ret = await postApiAuthPing(this.buildOptions()); + } catch (e) { + return false; + } + + return this.checkSuccessVal(ret) && ret.data.ping == "pong"; } private checkSuccessBool(ret: AxiosResponse): boolean {