genezio
Version:
Command line utility to interact with Genezio infrastructure.
24 lines (23 loc) • 867 B
JavaScript
import axios from "axios";
import { BACKEND_ENDPOINT } from "../constants.js";
import { getAuthToken } from "../utils/accounts.js";
import { GENEZIO_NOT_AUTH_ERROR_MSG, UserError } from "../errors.js";
import version from "../utils/version.js";
export async function getFrontendStatus(subdomain) {
// Check if user is authenticated
const authToken = await getAuthToken();
if (!authToken) {
throw new UserError(GENEZIO_NOT_AUTH_ERROR_MSG);
}
const response = await axios({
method: "GET",
url: `${BACKEND_ENDPOINT}/v2/frontend-status?subdomain=${subdomain}`,
headers: {
Authorization: `Bearer ${authToken}`,
"Accept-Version": `genezio-cli/${version}`,
},
maxContentLength: Infinity,
maxBodyLength: Infinity,
});
return response.data.frontendDeploymentStatus;
}