Skip to content

Commit

Permalink
Add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubkottnauer committed Jul 1, 2024
1 parent b1665e2 commit 91ebb7a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pages/api/harvest/[...path].ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
}

if (cookies.HARVEST_ACCESS_TOKEN && cookies.HARVEST_ACCOUNT_ID) {
console.log("got cookies");
const resp = await fetch(`${HARVEST_API_BASE_URL}/${req.url}`, {
method: req.method,
headers: {
Expand All @@ -31,10 +32,13 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
: JSON.stringify(req.body),
});

console.log("got response");
if (resp.headers.get("content-type")?.startsWith("application/json")) {
console.log("parsing data");
const data = await resp.json();

console.log("parsed data data");
if (req.url === "/users/me" && data) {
console.log("got data!");
const user = data as User;
Sentry.captureMessage(`Loaded page`, {
user: {
Expand Down

0 comments on commit 91ebb7a

Please sign in to comment.