Skip to content

Commit

Permalink
fix: resolved accessing token.text()
Browse files Browse the repository at this point in the history
  • Loading branch information
FindMalek committed Sep 9, 2024
1 parent 68194e3 commit 1b76d03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/soft-berries-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@undrstnd/ai-engine": patch
---

Solved accessing token.text()
4 changes: 3 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ export async function createUndrstnd(
},
}
)
console.log("Response object text:", await token.text())

const responseText = await token.text()
console.log("responseText:", responseText)
const responseJson = JSON.parse(responseText)
const apiKey = responseJson.token

console.log("apiKey:", apiKey)

if (!apiKey) {
throw new Error("API token not found")
}
Expand Down

0 comments on commit 1b76d03

Please sign in to comment.