deploy stuff, envs
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
// Global Strapi configuration
|
||||
export const STRAPI_CONFIG = {
|
||||
BASE_URL: (import.meta.env.STRAPI_URL as string) || (process.env.STRAPI_URL as string) || "http://localhost:1337",
|
||||
} as const;
|
||||
|
||||
// Helper function to get the base URL
|
||||
export function getStrapiBaseUrl(): string {
|
||||
return STRAPI_CONFIG.BASE_URL;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
endpoint: string;
|
||||
query?: Record<string, string>;
|
||||
@@ -22,8 +32,7 @@ interface Props {
|
||||
if (endpoint.startsWith('/')) {
|
||||
endpoint = endpoint.slice(1);
|
||||
}
|
||||
const strapiUrl = import.meta.env.STRAPI_URL || process.env.STRAPI_URL || "http://localhost:1337";
|
||||
console.log(strapiUrl);
|
||||
const strapiUrl = getStrapiBaseUrl();
|
||||
const url = new URL(`${strapiUrl}/api/${endpoint}`);
|
||||
|
||||
if (query) {
|
||||
|
||||
Reference in New Issue
Block a user