summaryrefslogtreecommitdiffhomepage
path: root/packages/console/app/src
diff options
context:
space:
mode:
authorFrank <[email protected]>2026-04-20 17:01:25 -0400
committerFrank <[email protected]>2026-04-20 17:01:27 -0400
commit3e8abac62556854ba65792000a7d878e2df0623b (patch)
treeffda27a40178f8184aca44d42d4b2267c6f028b9 /packages/console/app/src
parent65e99fcc2e26d3f1f32f4f36938245d5f785d415 (diff)
downloadopencode-3e8abac62556854ba65792000a7d878e2df0623b.tar.gz
opencode-3e8abac62556854ba65792000a7d878e2df0623b.zip
sync
Diffstat (limited to 'packages/console/app/src')
-rw-r--r--packages/console/app/src/routes/api/enterprise.ts21
1 files changed, 3 insertions, 18 deletions
diff --git a/packages/console/app/src/routes/api/enterprise.ts b/packages/console/app/src/routes/api/enterprise.ts
index 6560a9361..ff8f229e8 100644
--- a/packages/console/app/src/routes/api/enterprise.ts
+++ b/packages/console/app/src/routes/api/enterprise.ts
@@ -27,22 +27,7 @@ function splitFullName(fullName: string) {
return { firstName: parts[0], lastName: parts.slice(1).join(" ") }
}
-function getEmailOctopusApiKey() {
- if (process.env.EMAILOCTOPUS_API_KEY) return process.env.EMAILOCTOPUS_API_KEY
- try {
- return Resource.EMAILOCTOPUS_API_KEY.value
- } catch {
- return
- }
-}
-
function subscribe(email: string, fullName: string) {
- const apiKey = getEmailOctopusApiKey()
- if (!apiKey) {
- console.warn("Skipping EmailOctopus subscribe: missing API key")
- return Promise.resolve(false)
- }
-
const name = splitFullName(fullName)
const fields: Record<string, string> = {}
if (name.firstName) fields.FirstName = name.firstName
@@ -54,14 +39,14 @@ function subscribe(email: string, fullName: string) {
return fetch(`https://api.emailoctopus.com/lists/${EMAIL_OCTOPUS_LIST_ID}/contacts`, {
method: "PUT",
headers: {
- Authorization: `Bearer ${apiKey}`,
+ Authorization: `Bearer ${Resource.EMAILOCTOPUS_API_KEY.value}`,
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
}).then(
- (res) => {
+ async (res) => {
if (!res.ok) {
- console.error("EmailOctopus subscribe failed:", res.status, res.statusText)
+ console.error("EmailOctopus subscribe failed:", res.status, res.statusText, await res.text())
return false
}
return true