Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit fd0e890

Browse files
authored
Add /is_authenticated API path
1 parent 30e1be3 commit fd0e890

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

src/classes/Misc.js

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,14 @@ class Misc {
4646
headers.Cookie = global.cookies;
4747
let info = await variables
4848
.fetch('https://staging.repl.it/is_authenticated', {
49-
method: 'POST',
50-
headers,
51-
body: JSON.stringify({
52-
query: `
53-
query UserSearch($query: String!, $limit: Int!) {
54-
usernameSearch(query: $query, limit: $limit) {
55-
${variables.userAttributes}
56-
}
57-
}`,
58-
variables: {
59-
query,
60-
limit
61-
}
62-
})
49+
method: 'GET',
50+
headers
6351
}).then(res => res.json());
6452

65-
if (!info.data.usernameSearch) {
66-
throw new Error(`Cannot fetch users.`);
53+
if (!info) {
54+
throw new Error(`Cannot fetch authentication data.`);
6755
} else {
68-
return info.data.usernameSearch;
56+
return info;
6957
}
7058
}
7159
}

0 commit comments

Comments
 (0)