diff --git a/src/api/validateToken.ts b/src/api/validateToken.ts index 05b9269..e741d12 100644 --- a/src/api/validateToken.ts +++ b/src/api/validateToken.ts @@ -4,8 +4,8 @@ import { apiFetch } from "../helpers/api"; import { apiEndpoints, currentApiVersion, errorConnectionMessage } from "../helpers/constants"; import { PaginatedResponse, Space } from "../helpers/schemas"; -// Validate token by checking if data can be fetched without errors -export async function validateToken(): Promise { +// Validate api version and token by checking if data can be fetched without errors +export async function checkApiTokenValidity(): Promise { try { const { url, method } = apiEndpoints.getSpaces({ offset: 0, limit: 1 }); const response = await apiFetch>(url, { method: method }); diff --git a/src/components/EnsureAuthenticated.tsx b/src/components/EnsureAuthenticated.tsx index 2de9b35..e610a35 100644 --- a/src/components/EnsureAuthenticated.tsx +++ b/src/components/EnsureAuthenticated.tsx @@ -15,7 +15,7 @@ import { useForm } from "@raycast/utils"; import { useEffect, useState } from "react"; import { displayCode } from "../api/displayCode"; import { getToken } from "../api/getToken"; -import { validateToken } from "../api/validateToken"; +import { checkApiTokenValidity } from "../api/validateToken"; import { apiAppName, downloadUrl, localStorageKeys } from "../helpers/constants"; type EnsureAuthenticatedProps = { @@ -73,7 +73,7 @@ export default function EnsureAuthenticated({ placeholder, viewType, children }: const retrieveAndValidateToken = async () => { const token = await LocalStorage.getItem(localStorageKeys.appKey); if (token) { - const isValid = await validateToken(); + const isValid = await checkApiTokenValidity(); setHasToken(true); setTokenIsValid(isValid); } else {