Skip to content

Commit 9968682

Browse files
committed
RFR: use NotionUser for login
1 parent af045ae commit 9968682

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
},
6666
"publisher": "neurosity",
6767
"dependencies": {
68-
"@neurosity/notion": "^4.2.0",
68+
"@neurosity/notion": "^4.2.1",
6969
"@sindresorhus/do-not-disturb": "^1.1.0",
7070
"@types/regression": "^2.0.0",
7171
"@types/universal-analytics": "^0.4.3",

src/login.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as vscode from "vscode";
22

3-
import { Notion } from "@neurosity/notion";
3+
import { Notion, NotionUser } from "@neurosity/notion";
44

55
export let notion: any;
66
export let logged_in: boolean = false;
@@ -91,9 +91,15 @@ export function loginFromSavedState(saved_state: any) {
9191
// This try/catch might be able to detect invalid saved state, as
9292
// it will probably throw an error
9393
try {
94+
const user = new NotionUser(
95+
saved_state,
96+
saved_state.stsTokenManager,
97+
saved_state
98+
);
99+
94100
notion
95101
.auth()
96-
.updateCurrentUser(saved_state)
102+
.updateCurrentUser(user)
97103
.then(() => {
98104
logged_in = true;
99105
if (login_callback) login_callback();

0 commit comments

Comments
 (0)