Skip to content

Commit

Permalink
added redirect to home for staking page with login (#24)
Browse files Browse the repository at this point in the history
updated REST and RPC urls for tendermint in cloudflare worker config
  • Loading branch information
kombos authored Jul 20, 2022
1 parent 3fde10d commit ae5189a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
- run: npm run build --if-present
env:
CI: false
REACT_APP_API_KEY: 'https://rest-lb.assetmantle.one'
REACT_APP_TENDERMINT_RPC_ENDPOINT: 'https://rpc-lb.assetmantle.one'
REACT_APP_API_KEY: 'https://rest.assetmantle.one'
REACT_APP_TENDERMINT_RPC_ENDPOINT: 'https://rpc.assetmantle.one'
REACT_APP_WEBSITE_URL: 'https://wallet.assetmantle.one'
REACT_APP_EXPLORER_API: 'https://explorer.assetmantle.one'
REACT_APP_MAIL_CHIMP_URL: ''
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
- run: npm run build --if-present
env:
CI: false
REACT_APP_API_KEY: 'https://rest-lb.assetmantle.one'
REACT_APP_TENDERMINT_RPC_ENDPOINT: 'https://rpc-lb.assetmantle.one'
REACT_APP_API_KEY: 'https://rest.assetmantle.one'
REACT_APP_TENDERMINT_RPC_ENDPOINT: 'https://rpc.assetmantle.one'
REACT_APP_WEBSITE_URL: 'https://wallet.persistence.one'
REACT_APP_EXPLORER_API: 'https://explorer.assetmantle.one'
REACT_APP_MAIL_CHIMP_URL: ''
Expand Down
1 change: 1 addition & 0 deletions src/constants/localStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ export const THEME = "theme";
export const ACCOUNT_NUMBER = "accountNumber";
export const LEDGER = "ledger";
export const ADDRESS_INDEX = "addressIndex";
export const LOGIN_MODES_ARRAY = ["keplr", "ledger", "keystore", "address"];
4 changes: 2 additions & 2 deletions src/views/DashboardWallet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import GenerateKeyStore from "../../containers/GenerateKeyStore";
import ChangeKeyStorePassword from "../../containers/ChangeKeyStorePassword";
import {useDispatch} from "react-redux";
import { useHistory, useParams } from "react-router-dom";
import { LOGIN_INFO} from "../../constants/localStorage";
import { LOGIN_INFO, LOGIN_MODES_ARRAY} from "../../constants/localStorage";
import {addressDetails, setAddress} from "../../store/actions/signIn/address";
import {fetchDelegationsCount} from "../../store/actions/delegations";
import {fetchBalance, fetchTransferableVestingAmount} from "../../store/actions/balance";
Expand All @@ -31,7 +31,7 @@ const DashboardWallet = () => {
const {selectedLoginMode} = useParams();


const loginModesArray = ["keplr", "ledger", "keystore", "address"];
const loginModesArray = LOGIN_MODES_ARRAY;


const fetchApi = async (address, loginMode) => {
Expand Down
32 changes: 29 additions & 3 deletions src/views/Staking/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
import React from "react";
import Staking from "../../containers/Staking";
import React, { useEffect, useState } from "react";
import { useHistory, useParams } from "react-router-dom";
import LoadingComponent from "../../components/LoadingComponent";
import { LOGIN_INFO } from "../../constants/localStorage";
import ChangeKeyStorePassword from "../../containers/ChangeKeyStorePassword";
import DashboardHeader from "../../containers/Common/DashboardHeader";
import GenerateKeyStore from "../../containers/GenerateKeyStore";
import ChangeKeyStorePassword from "../../containers/ChangeKeyStorePassword";
import Staking from "../../containers/Staking";

const DashboardStaking = () => {

const {selectedLoginMode} = useParams();
const [loading, setLoading] = useState(true);
const history = useHistory();





useEffect(() => {
console.log("inside useEffect of DashboardWallet");
const loginInfo = JSON.parse(localStorage.getItem(LOGIN_INFO)) || {};

if((selectedLoginMode == null || selectedLoginMode == undefined) && (loginInfo.address == null || loginInfo.address == undefined)) {
setLoading(false);
history.push('/');
return;
}
}, [selectedLoginMode]);

if(loading) {
return <LoadingComponent />;
}

return (
<div className="main-section">
<DashboardHeader/>
Expand Down

0 comments on commit ae5189a

Please sign in to comment.