Chore: Migrate REST API - getServerInfo to Typescript (#3900)

This commit is contained in:
Reinaldo Neto 2022-03-15 14:33:29 -03:00 committed by GitHub
parent ee336a84a3
commit 07094aabe6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -379,7 +379,7 @@ async function getServerInfo(server: string) {
const response = await RNFetchBlob.fetch('GET', `${server}/api/info`, { ...RocketChatSettings.customHeaders }); const response = await RNFetchBlob.fetch('GET', `${server}/api/info`, { ...RocketChatSettings.customHeaders });
try { try {
// Try to resolve as json // Try to resolve as json
const jsonRes = response.json(); const jsonRes: { version?: string; success: boolean } = response.json();
if (!jsonRes?.success) { if (!jsonRes?.success) {
return { return {
success: false, success: false,

View File

@ -18,7 +18,7 @@ const methods = {
}; };
export const compareServerVersion = ( export const compareServerVersion = (
currentServerVersion: string | null, currentServerVersion: string | null | undefined,
method: keyof typeof methods, method: keyof typeof methods,
versionToCompare: string versionToCompare: string
): boolean => ): boolean =>