Skip to content

Commit fdfcfb3

Browse files
committed
Check login by getMe response
1 parent 0add389 commit fdfcfb3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nodejs/src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,12 @@ class API {
9898
}
9999

100100
async isLogin() {
101-
const response = await this.fetch(`${this.serverUrl}/me`)
102-
return response.status === 200
101+
try {
102+
const data = await this.getMe()
103+
return data.status === 'ok'
104+
} catch (err) {
105+
return false
106+
}
103107
}
104108

105109
async getMe() {

0 commit comments

Comments
 (0)