fix: Restore DIRECTUS_TOKEN definition to fix ReferenceError

This commit is contained in:
cawcenter
2025-12-12 22:36:58 -05:00
parent ad83325339
commit 5c13af2571

View File

@@ -20,6 +20,8 @@ if (typeof process !== 'undefined' && process.env && process.env.INTERNAL_DIRECT
INTERNAL_URL = process.env.INTERNAL_DIRECTUS_URL;
}
const DIRECTUS_TOKEN = import.meta.env.DIRECTUS_ADMIN_TOKEN || (typeof process !== 'undefined' && process.env ? process.env.DIRECTUS_ADMIN_TOKEN : '') || '';
// Select URL based on environment (Server vs Client)
const DIRECTUS_URL = (typeof window === 'undefined') ? INTERNAL_URL : PUBLIC_URL;
@@ -33,6 +35,10 @@ export function getDirectusClient(token?: string) {
return client.with(staticToken(token || DIRECTUS_TOKEN));
}
if (token || DIRECTUS_TOKEN) {
return client.with(staticToken(token || DIRECTUS_TOKEN));
}
return client;
}