Skip to content

Commit

Permalink
hotfix login
Browse files Browse the repository at this point in the history
  • Loading branch information
damienen committed Jan 16, 2024
1 parent 6218fbb commit 973d034
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 30 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "data-dex",
"version": "1.9.3",
"version": "1.9.4",
"description": "The Itheum Data DEX enables you to trade your data using web3 tech",
"dependencies": {
"@chakra-ui/icons": "2.1.1",
Expand Down
19 changes: 0 additions & 19 deletions src/pages/App/AppMultiversX.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ function App({ onShowConnectWalletModal }: { onShowConnectWalletModal: any }) {
const [walletUsedSession] = useLocalStorage("itm-wallet-used", null);
const [dataCatLinkedSession, setDataCatLinkedSession] = useLocalStorage("itm-datacat-linked", null);
const { address: mxAddress } = useGetAccountInfo();
const { appVersion } = useAccountStore();
const { isLoggedIn: isMxLoggedIn, loginMethod: mxLoginMethod } = useGetLoginInfo();
const { chainID } = useGetNetworkConfig();
const [menuItem, setMenuItem] = useState(MENU.LANDING);
Expand Down Expand Up @@ -101,7 +100,6 @@ function App({ onShowConnectWalletModal }: { onShowConnectWalletModal: any }) {
}
}, [chainID]);

// console.log(appVersion);
useEffect(() => {
// Mx authenticated for 1st time or is a reload.
async function mxSessionInit() {
Expand Down Expand Up @@ -148,23 +146,6 @@ function App({ onShowConnectWalletModal }: { onShowConnectWalletModal: any }) {
}
};

useEffect(() => {
const handleAppVersioningLogin = async () => {
await sleep(1);
const localStorageAppVersion = localStorage.getItem("app-version");
console.log(appVersion, localStorageAppVersion);
const currentLocalStorageVersion = localStorageAppVersion;
if (appVersion !== localStorageAppVersion) {
if (isMxLoggedIn) {
if (currentLocalStorageVersion !== null) {
handleLogout();
}
}
}
};
handleAppVersioningLogin();
}, [isMxLoggedIn]);

const linkOrRefreshDataDATAccount = async (setExplicit?: boolean | undefined) => {
setLoadingDataCATAccount(true);
await sleep(3);
Expand Down
6 changes: 0 additions & 6 deletions src/pages/App/ModalAuthPickerMultiversX.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ function ModalAuthPickerMx({ resetLaunchMode }: { resetLaunchMode: any }) {
const { isOpen: isProgressModalOpen, onOpen: onProgressModalOpen, onClose: onProgressModalClose } = useDisclosure();
const [, setWalletUsedSession] = useLocalStorage("itm-wallet-used", null);
const { pathname } = useLocation();
const appVersion = process.env.REACT_APP_VERSION;
const navigate = useNavigate();

useEffect(() => {
Expand Down Expand Up @@ -114,7 +113,6 @@ function ModalAuthPickerMx({ resetLaunchMode }: { resetLaunchMode: any }) {
<WrapItem
onClick={() => {
goMxLogin(WALLETS.MX_XPORTALAPP);
localStorage.setItem("app-version", appVersion || "");
}}
className="auth_wrap">
<WalletConnectLoginButton
Expand All @@ -127,7 +125,6 @@ function ModalAuthPickerMx({ resetLaunchMode }: { resetLaunchMode: any }) {
<WrapItem
onClick={() => {
goMxLogin(WALLETS.MX_DEFI);
localStorage.setItem("app-version", appVersion || "");
}}
className="auth_wrap">
<ExtensionLoginButton loginButtonText={"DeFi Wallet"} buttonClassName="auth_button" {...commonProps}></ExtensionLoginButton>
Expand All @@ -136,7 +133,6 @@ function ModalAuthPickerMx({ resetLaunchMode }: { resetLaunchMode: any }) {
<WrapItem
onClick={() => {
goMxLogin(WALLETS.MX_WEBWALLET);
localStorage.setItem("app-version", appVersion || "");
}}
className="auth_wrap">
<WebWalletLoginButton loginButtonText={"Web Wallet"} buttonClassName="auth_button" {...commonProps}></WebWalletLoginButton>
Expand All @@ -145,7 +141,6 @@ function ModalAuthPickerMx({ resetLaunchMode }: { resetLaunchMode: any }) {
<WrapItem
onClick={() => {
goMxLogin(WALLETS.MX_LEDGER);
localStorage.setItem("app-version", appVersion || "");
}}
className="auth_wrap">
<LedgerLoginButton loginButtonText={"Ledger"} buttonClassName="auth_button" {...commonProps}></LedgerLoginButton>
Expand All @@ -154,7 +149,6 @@ function ModalAuthPickerMx({ resetLaunchMode }: { resetLaunchMode: any }) {
<WrapItem
onClick={() => {
goMxLogin(WALLETS.MX_XALIAS);
localStorage.setItem("app-version", appVersion || "");
}}
className="auth_wrap">
<WebWalletLoginButton
Expand Down
4 changes: 0 additions & 4 deletions src/store/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@ import { create } from "zustand";
type State = {
itheumBalance: number;
accessToken: string;
appVersion: string | undefined;
};

type Action = {
updateItheumBalance: (itheumBalance: State["itheumBalance"]) => void;
updateAccessToken: (accessToken: State["accessToken"]) => void;
updateAppVersion: (newAppVersion: State["appVersion"]) => void;
};

export const useAccountStore = create<State & Action>((set) => ({
itheumBalance: 0,
updateItheumBalance: (value: number) => set(() => ({ itheumBalance: value })),
accessToken: "",
updateAccessToken: (value: string) => set(() => ({ accessToken: value })),
appVersion: process.env.REACT_APP_VERSION,
updateAppVersion: (newAppVersion) => set({ appVersion: newAppVersion }),
}));

0 comments on commit 973d034

Please sign in to comment.