Merge two login functions.

This commit is contained in:
Yang Luo
2021-03-20 00:23:37 +08:00
parent d0e243fca3
commit 18c021b009
6 changed files with 121 additions and 153 deletions

View File

@ -44,14 +44,6 @@ export function logout() {
}).then(res => res.json());
}
export function authLogin(values) {
return fetch(`${authConfig.serverUrl}/api/auth/login`, {
method: 'POST',
credentials: "include",
body: JSON.stringify(values),
}).then(res => res.json());
}
export function getOAuthCode(clientId, responseType, redirectUri, scope, state) {
return fetch(`${authConfig.serverUrl}/api/oauth/code?clientId=${clientId}&responseType=${responseType}&redirectUri=${redirectUri}&scope=${scope}&state=${state}`, {
method: 'GET',

View File

@ -46,7 +46,7 @@ class AuthCallback extends React.Component {
redirectUri: redirectUri,
method: this.state.method,
};
AuthBackend.authLogin(body)
AuthBackend.login(body)
.then((res) => {
if (res.status === "ok") {
window.location.href = '/';