diff --git a/.changeset/soft-berries-cheat.md b/.changeset/soft-berries-cheat.md new file mode 100644 index 0000000..9f57cc4 --- /dev/null +++ b/.changeset/soft-berries-cheat.md @@ -0,0 +1,5 @@ +--- +"@undrstnd/ai-engine": patch +--- + +Solved accessing token.text() diff --git a/src/client.ts b/src/client.ts index 835bfd2..8fddc82 100644 --- a/src/client.ts +++ b/src/client.ts @@ -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") }