Skip to content

Commit 684caa3

Browse files
committed
Fix login post request always send http 200
1 parent a14bec7 commit 684caa3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

nodejs/src/index.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,26 +74,23 @@ class API {
7474
}
7575

7676
async login(email: string, password: string) {
77-
const response = await this.fetch(`${this.serverUrl}/login`, {
77+
await this.fetch(`${this.serverUrl}/login`, {
7878
method: 'post',
7979
body: encodeFormComponent({email, password}),
8080
headers: await this.wrapHeaders({
8181
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
8282
})
8383
})
84-
85-
return response.status === 200
8684
}
8785

8886
async loginLdap(username: string, password: string) {
89-
const response = await this.fetch(`${this.serverUrl}/auth/ldap`, {
87+
await this.fetch(`${this.serverUrl}/auth/ldap`, {
9088
method: 'post',
9189
body: encodeFormComponent({username, password}),
9290
headers: await this.wrapHeaders({
9391
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
9492
})
9593
})
96-
return response.status === 200
9794
}
9895

9996
async logout() {
@@ -199,7 +196,7 @@ class API {
199196
} catch (err) {
200197
return []
201198
}
202-
199+
203200
return data.teams || []
204201
}
205202

0 commit comments

Comments
 (0)