import axios from "axios"; import type { GetGoogleAuthUrlResponse, LogoutResponse } from "../types/api/auth"; import type { ApiError } from "../types/api/error"; import { GetBackendUrl } from "./environment"; const BACKEND_URL = GetBackendUrl(); export async function GetGoogleAuthUrl(): Promise { const response = await axios.get(`${BACKEND_URL}/v2/api/auth/login`); if (response.status !== 200) { const err: ApiError = { status: response.status, message: "[FAIL] Something went wrong." }; return err; } return response.data.url; } export async function Logout(): Promise { const response = await axios.get(`${BACKEND_URL}/v2/api/auth/logout`); // This should never happen if (response.status !== 204) console.error("LOGOUT FAILED"); }