Skip to content

Commit 317a343

Browse files
authored
use update vs set & grab the right json (#929)
- using 'set' causes the information to disappear because it unsets user, which means the schema won't match. update solves that - also we were sending the wrong json into set
1 parent 8df1754 commit 317a343

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

recipes/gcal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ const refreshAuthToken = async (auth: Cell<Auth>) => {
137137
},
138138
).then((res) => res.json());
139139

140-
return refresh_response as Auth;
140+
return refresh_response.tokenInfo as Auth;
141141
};
142142

143143
const calendarUpdater = handler(
@@ -185,7 +185,7 @@ export async function fetchCalendar(
185185

186186
if (cur.expiresAt && Date.now() > cur.expiresAt) {
187187
const resp = await refreshAuthToken(auth);
188-
auth.set(resp);
188+
auth.update(resp);
189189
console.log("refresh_data", resp);
190190
}
191191

recipes/gmail.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ const refreshAuthToken = async (auth: Cell<Auth>) => {
188188
},
189189
).then((res) => res.json());
190190

191-
return refresh_response as Auth;
191+
return refresh_response.tokenInfo as Auth;
192192
};
193193

194194
const googleUpdater = handler(
@@ -407,7 +407,7 @@ export async function fetchEmail(
407407

408408
if (cur.expiresAt && Date.now() > cur.expiresAt) {
409409
const resp = await refreshAuthToken(auth);
410-
auth.set(resp);
410+
auth.update(resp);
411411
console.log("refresh_data", resp);
412412
}
413413

0 commit comments

Comments
 (0)