From 42751d52140f43672024aba63e11327e1ecb6034 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 13 Mar 2024 17:30:03 -0400 Subject: [PATCH] refactor: update ping api to use new PingResponse --- src/account.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 {