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 = '/';

View File

@ -3380,20 +3380,13 @@ copy-descriptor@^0.1.0:
resolved "https://registry.npm.taobao.org/copy-descriptor/download/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=
copy-to-clipboard@^3.2.0:
copy-to-clipboard@^3.2.0, copy-to-clipboard@^3.3.1:
version "3.3.1"
resolved "https://registry.npm.taobao.org/copy-to-clipboard/download/copy-to-clipboard-3.3.1.tgz#115aa1a9998ffab6196f93076ad6da3b913662ae"
integrity sha1-EVqhqZmP+rYZb5MHatbaO5E2Yq4=
dependencies:
toggle-selection "^1.0.6"
copy-to-clipboard@^3.3.1:
version "3.3.1"
resolved "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.3.1.tgz#115aa1a9998ffab6196f93076ad6da3b913662ae"
integrity sha512-i13qo6kIHTTpCm8/Wup+0b1mVWETvu2kIMzKoK8FpkLkFxlt0znUAHcMzox+T8sPlqtZXq3CulEjQHsYiGFJUw==
dependencies:
toggle-selection "^1.0.6"
core-js-compat@^3.6.2:
version "3.6.5"
resolved "https://registry.npm.taobao.org/core-js-compat/download/core-js-compat-3.6.5.tgz#2a51d9a4e25dfd6e690251aa81f99e3c05481f1c"