Skip to content

Commit

Permalink
Fixed page reload on network refresh (#53)
Browse files Browse the repository at this point in the history
* Fixed page reload on network refresh

* 1.0.3

* Fixed version
  • Loading branch information
razvantomegea authored Oct 3, 2024
1 parent 2853505 commit e9cd9ca
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 33 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [[1.0.2](https://github.com/multiversx/mx-lite-wallet-dapp/pull/54)] - 2024-10-03

- [Fixed page reload on network refresh](https://github.com/multiversx/mx-lite-wallet-dapp/pull/53)
- [Updated extras API and NFTs endpoints](https://github.com/multiversx/mx-wallet-dapp/pull/52)
- [Removed faucet when there is no recaptcha key](https://github.com/multiversx/mx-wallet-dapp/pull/51)
- [Added reCaptcha bypass](https://github.com/multiversx/mx-wallet-dapp/pull/49)
Expand All @@ -15,9 +18,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Fixed issue token and issue NFT](https://github.com/multiversx/mx-wallet-dapp/pull/46)
- [Added ability to issue NFTs and collections](https://github.com/multiversx/mx-wallet-dapp/pull/45)
- [Fixed network switch and issue token](https://github.com/multiversx/mx-lite-wallet-dapp/pull/44)

## [[1.0.2](https://github.com/multiversx/mx-lite-wallet-dapp/pull/42)] - 2024-08-27

- [Added register sovereign token](https://github.com/multiversx/mx-wallet-dapp/pull/43)
- [Added faucet and issue token](https://github.com/multiversx/mx-wallet-dapp/pull/41)
- [Fixed package.json scripts](https://github.com/multiversx/mx-wallet-dapp/pull/39)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@multiversx/mx-lite-wallet-dapp",
"description": "MultiversX Lite Wallet DApp",
"version": "1.0.1",
"version": "1.0.2",
"author": "MultiversX",
"license": "GPL-3.0-or-later",
"repository": "@multiversx/mx-lite-wallet-dapp",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const useSetNativeAuthInterceptors = () => {

let bearerToken = newToken;
const hasAllowedURLs =
config.baseURL?.includes('extras-lite-api.multiversx.com') ||
config.baseURL?.includes('extras-api.multiversx.com') ||
config.baseURL?.includes('api.xportal.com') ||
config.baseURL?.includes('tools.multiversx.com');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ export const useRefreshNativeAuthTokenForNetwork = () => {
return async ({
networkId,
origin,
preventPageReload,
signMessageCallback
}: {
networkId: string;
origin: string;
preventPageReload?: boolean;
signMessageCallback: (
messageToSign: SignableMessage
) => Promise<SignableMessage>;
Expand Down Expand Up @@ -45,8 +47,10 @@ export const useRefreshNativeAuthTokenForNetwork = () => {

dispatch(changeNetwork(foundNetwork));

setTimeout(() => {
window.location.reload();
});
if (!preventPageReload) {
setTimeout(() => {
window.location.reload();
}, 10);
}
};
};
8 changes: 4 additions & 4 deletions src/config/config.devnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const networks: NetworkType[] = [
name: 'Devnet',
apiAddress: 'https://devnet-api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://devnet-extras-lite-api.multiversx.com',
extrasApi: 'https://devnet-extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://devnet-api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://devnet-wallet.multiversx.com',
Expand All @@ -22,7 +22,7 @@ export const networks: NetworkType[] = [
name: 'Mainnet',
apiAddress: 'https://api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://extras-lite-api.multiversx.com',
extrasApi: 'https://extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://wallet.multiversx.com',
Expand All @@ -34,7 +34,7 @@ export const networks: NetworkType[] = [
name: 'Sovereign',
apiAddress: 'https://api-sovereign-test.elrond.ro',
gatewayUrl: '',
extrasApi: 'https://extras-lite-api-sovereign-test.elrond.ro',
extrasApi: 'https://extras-api-sovereign-test.elrond.ro',
sampleAuthenticatedDomains: ['https://api-sovereign-test.elrond.ro'],
sovereignContractAddress: '',
walletAddress: 'https://wallet.voyager1.dev',
Expand All @@ -46,7 +46,7 @@ export const networks: NetworkType[] = [
name: 'Testnet',
apiAddress: 'https://testnet-api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://testnet-extras-lite-api.multiversx.com',
extrasApi: 'https://testnet-extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://testnet-api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://testnet-wallet.multiversx.com',
Expand Down
10 changes: 5 additions & 5 deletions src/config/config.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const networks: NetworkType[] = [
name: 'Devnet',
apiAddress: 'https://devnet-api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://devnet-extras-lite-api.multiversx.com',
extrasApi: 'https://devnet-extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://devnet-api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://devnet-wallet.multiversx.com',
Expand All @@ -22,7 +22,7 @@ export const networks: NetworkType[] = [
name: 'Gateway',
apiAddress: '',
gatewayUrl: 'https://devnet-gateway.multiversx.com',
extrasApi: 'https://devnet-extras-lite-api.multiversx.com',
extrasApi: 'https://devnet-extras-api.multiversx.com',
sampleAuthenticatedDomains: [''],
sovereignContractAddress: '',
walletAddress: 'https://devnet-wallet.multiversx.com',
Expand All @@ -34,7 +34,7 @@ export const networks: NetworkType[] = [
name: 'Mainnet',
apiAddress: 'https://api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://extras-lite-api.multiversx.com',
extrasApi: 'https://extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://wallet.multiversx.com',
Expand All @@ -46,7 +46,7 @@ export const networks: NetworkType[] = [
name: 'Sovereign',
apiAddress: 'https://api-sovereign-test.elrond.ro',
gatewayUrl: '',
extrasApi: 'https://extras-lite-api-sovereign-test.elrond.ro',
extrasApi: 'https://extras-api-sovereign-test.elrond.ro',
sampleAuthenticatedDomains: ['https://api-sovereign-test.elrond.ro'],
sovereignContractAddress: '',
walletAddress: 'https://wallet.voyager1.dev',
Expand All @@ -58,7 +58,7 @@ export const networks: NetworkType[] = [
name: 'Testnet',
apiAddress: 'https://testnet-api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://testnet-extras-lite-api.multiversx.com',
extrasApi: 'https://testnet-extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://testnet-api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://testnet-wallet.multiversx.com',
Expand Down
8 changes: 4 additions & 4 deletions src/config/config.mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const networks: NetworkType[] = [
name: 'Devnet',
apiAddress: 'https://devnet-api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://devnet-extras-lite-api.multiversx.com',
extrasApi: 'https://devnet-extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://devnet-api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://devnet-wallet.multiversx.com',
Expand All @@ -22,7 +22,7 @@ export const networks: NetworkType[] = [
name: 'Mainnet',
apiAddress: 'https://api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://extras-lite-api.multiversx.com',
extrasApi: 'https://extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://wallet.multiversx.com',
Expand All @@ -34,7 +34,7 @@ export const networks: NetworkType[] = [
name: 'Sovereign',
apiAddress: 'https://api-sovereign-test.elrond.ro',
gatewayUrl: '',
extrasApi: 'https://extras-lite-api-sovereign-test.elrond.ro',
extrasApi: 'https://extras-api-sovereign-test.elrond.ro',
sampleAuthenticatedDomains: ['https://api-sovereign-test.elrond.ro'],
sovereignContractAddress: '',
walletAddress: 'https://wallet.voyager1.dev',
Expand All @@ -46,7 +46,7 @@ export const networks: NetworkType[] = [
name: 'Testnet',
apiAddress: 'https://testnet-api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://testnet-extras-lite-api.multiversx.com',
extrasApi: 'https://testnet-extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://testnet-api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://testnet-wallet.multiversx.com',
Expand Down
8 changes: 4 additions & 4 deletions src/config/config.sovereign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const networks: NetworkType[] = [
name: 'Devnet',
apiAddress: 'https://devnet-api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://devnet-extras-lite-api.multiversx.com',
extrasApi: 'https://devnet-extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://devnet-api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://devnet-wallet.multiversx.com',
Expand All @@ -22,7 +22,7 @@ export const networks: NetworkType[] = [
name: 'Mainnet',
apiAddress: 'https://api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://extras-lite-api.multiversx.com',
extrasApi: 'https://extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://wallet.multiversx.com',
Expand All @@ -34,7 +34,7 @@ export const networks: NetworkType[] = [
name: 'Sovereign',
apiAddress: 'https://api-sovereign-test.elrond.ro',
gatewayUrl: '',
extrasApi: 'https://extras-lite-api-sovereign-test.elrond.ro',
extrasApi: 'https://extras-api-sovereign-test.elrond.ro',
sampleAuthenticatedDomains: ['https://api-sovereign-test.elrond.ro'],
sovereignContractAddress: '',
walletAddress: 'https://wallet.voyager1.dev',
Expand All @@ -46,7 +46,7 @@ export const networks: NetworkType[] = [
name: 'Testnet',
apiAddress: 'https://testnet-api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://testnet-extras-lite-api.multiversx.com',
extrasApi: 'https://testnet-extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://testnet-api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://testnet-wallet.multiversx.com',
Expand Down
8 changes: 4 additions & 4 deletions src/config/config.testnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const networks: NetworkType[] = [
name: 'Devnet',
apiAddress: 'https://devnet-api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://devnet-extras-lite-api.multiversx.com',
extrasApi: 'https://devnet-extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://devnet-api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://devnet-wallet.multiversx.com',
Expand All @@ -22,7 +22,7 @@ export const networks: NetworkType[] = [
name: 'Mainnet',
apiAddress: 'https://api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://extras-lite-api.multiversx.com',
extrasApi: 'https://extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://wallet.multiversx.com',
Expand All @@ -34,7 +34,7 @@ export const networks: NetworkType[] = [
name: 'Sovereign',
apiAddress: 'https://api-sovereign-test.elrond.ro',
gatewayUrl: '',
extrasApi: 'https://extras-lite-api-sovereign-test.elrond.ro',
extrasApi: 'https://extras-api-sovereign-test.elrond.ro',
sampleAuthenticatedDomains: ['https://api-sovereign-test.elrond.ro'],
sovereignContractAddress: '',
walletAddress: 'https://wallet.voyager1.dev',
Expand All @@ -46,7 +46,7 @@ export const networks: NetworkType[] = [
name: 'Testnet',
apiAddress: 'https://testnet-api.multiversx.com',
gatewayUrl: '',
extrasApi: 'https://testnet-extras-lite-api.multiversx.com',
extrasApi: 'https://testnet-extras-api.multiversx.com',
sampleAuthenticatedDomains: ['https://testnet-api.multiversx.com'],
sovereignContractAddress: '',
walletAddress: 'https://testnet-wallet.multiversx.com',
Expand Down
3 changes: 2 additions & 1 deletion src/pages/RegisterToken/hooks/useRegisterTokenForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export const useRegisterTokenForm = () => {
await refreshNativeAuthTokenForNetwork({
networkId,
origin: window.location.origin,
signMessageCallback: (messageToSign) => Promise.resolve(messageToSign)
signMessageCallback: (messageToSign) => Promise.resolve(messageToSign),
preventPageReload: true
});
};

Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { nodePolyfills } from 'vite-plugin-node-polyfills';
import svgrPlugin from 'vite-plugin-svgr';
import tsconfigPaths from 'vite-tsconfig-paths';

const port = Number(process.env.PORT) || 3002;
const port = Number(process.env.PORT) || 3000;
const proxyHost = `https://localhost:${port}`;

export default defineConfig({
Expand Down

0 comments on commit e9cd9ca

Please sign in to comment.