Add auth folder.

This commit is contained in:
Yang Luo
2021-02-14 14:34:03 +08:00
parent 40587f35e3
commit 001496b90f
11 changed files with 42 additions and 46 deletions

View File

@ -14,13 +14,6 @@
import * as Setting from "../Setting";
export function getUser(username) {
return fetch(`${Setting.ServerUrl}/api/get-user?username=${username}`, {
method: 'GET',
credentials: 'include'
}).then(res => res.json());
}
export function getAccount() {
return fetch(`${Setting.ServerUrl}/api/get-account`, {
method: 'GET',
@ -52,8 +45,7 @@ export function logout() {
}
export function authLogin(providerName, code, state, redirectUrl, addition) {
console.log(redirectUrl)
return fetch(`${Setting.ServerUrl}/api/auth/github?provider=${providerName}&code=${code}&state=${state}&redirect_url=${redirectUrl}&addition=${addition}`, {
return fetch(`${Setting.ServerUrl}/api/auth/login?provider=${providerName}&code=${code}&state=${state}&redirect_url=${redirectUrl}&addition=${addition}`, {
method: 'GET',
credentials: 'include',
}).then(res => res.json());