mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 20:50:19 +08:00
feat: use dynamic import to load web3Auth (#2757)
* feat: use dynamic import to load web3Auth and success reduce the size of signin page to 720KB when web3 idp disabled * feat: avoid frequent import in OAuthWidget.js which may cause e2e test EPIPE error * feat: remove import may cause e2e error * feat: remove import may cause e2e error * feat: remove bug may cause e2e error * feat: try use chrome in ci/cd instead of electron to solve e2e error
This commit is contained in:
@ -20,7 +20,6 @@ import * as Setting from "../Setting";
|
||||
import * as Provider from "../auth/Provider";
|
||||
import * as AuthBackend from "../auth/AuthBackend";
|
||||
import {goToWeb3Url} from "../auth/ProviderButton";
|
||||
import {delWeb3AuthToken} from "../auth/Web3Auth";
|
||||
import AccountAvatar from "../account/AccountAvatar";
|
||||
|
||||
class OAuthWidget extends React.Component {
|
||||
@ -98,7 +97,22 @@ class OAuthWidget extends React.Component {
|
||||
user: this.props.user,
|
||||
};
|
||||
if (providerType === "MetaMask" || providerType === "Web3Onboard") {
|
||||
delWeb3AuthToken(linkedValue);
|
||||
import("../auth/Web3Auth")
|
||||
.then(module => {
|
||||
const delWeb3AuthToken = module.delWeb3AuthToken;
|
||||
delWeb3AuthToken(linkedValue);
|
||||
AuthBackend.unlink(body)
|
||||
.then((res) => {
|
||||
if (res.status === "ok") {
|
||||
Setting.showMessage("success", "Unlinked successfully");
|
||||
|
||||
this.unlinked();
|
||||
} else {
|
||||
Setting.showMessage("error", `Failed to unlink: ${res.msg}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
AuthBackend.unlink(body)
|
||||
.then((res) => {
|
||||
|
Reference in New Issue
Block a user