Skip to content

Commit

Permalink
no_cache every endpoint query for now
Browse files Browse the repository at this point in the history
  • Loading branch information
wraitii committed Jan 7, 2025
1 parent b78ac4e commit 1b60b16
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/explorer/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { onMounted, ref } from "vue";
const consensusInfo = ref(null);
const fetchConsensusInfo = async () => {
const response = await fetch(getNetworkApiUrl(network.value) + "/v1/consensus/info");
const response = await fetch(getNetworkApiUrl(network.value) + `/v1/consensus/info?no_cache=${Date.now()}`);
consensusInfo.value = await response.json();
};
Expand Down
6 changes: 4 additions & 2 deletions src/state/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class BlockStore {
if (this.data[hash]) {
return;
}
const response = await fetch(`${getNetworkApiUrl(this.network)}/v1/indexer/block/hash/${hash}`);
const response = await fetch(`${getNetworkApiUrl(this.network)}/v1/indexer/block/hash/${hash}?no_cache=${Date.now()}`);
let item = await response.json();
this.data[item.hash] = item;
}
Expand All @@ -46,7 +46,9 @@ export class BlockStore {
await this.load(hash);
}
// TODO: change this once I've deployed the fix
const response = await fetch(`${getNetworkApiUrl(this.network)}/v1/indexer/transactions/block/${this.data[hash].height}`);
const response = await fetch(
`${getNetworkApiUrl(this.network)}/v1/indexer/transactions/block/${this.data[hash].height}?no_cache=${Date.now()}`,
);
let resp = await response.json();
this.tx_hashes_by_block[hash] = resp.map((tx: any) => tx.tx_hash);
}
Expand Down
2 changes: 1 addition & 1 deletion src/state/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class ContractStore {
if (this.data[contract_name]) {
return;
}
const response = await fetch(`${getNetworkApiUrl(this.network)}/v1/indexer/contract/${contract_name}`);
const response = await fetch(`${getNetworkApiUrl(this.network)}/v1/indexer/contract/${contract_name}?no_cache=${Date.now()}`);
let item = await response.json();
this.data[item.contract_name] = item;
}
Expand Down
2 changes: 1 addition & 1 deletion src/state/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class TransactionStore {
if (this.data[tx_hash]) {
return;
}
const response = await fetch(`${getNetworkApiUrl(this.network)}/v1/indexer/transaction/hash/${tx_hash}`);
const response = await fetch(`${getNetworkApiUrl(this.network)}/v1/indexer/transaction/hash/${tx_hash}?no_cache=${Date.now()}`);
let item = await response.json();
this.data[item.tx_hash] = item;
}
Expand Down

0 comments on commit 1b60b16

Please sign in to comment.