Skip to content

Commit

Permalink
add more axios retries across app
Browse files Browse the repository at this point in the history
  • Loading branch information
secondl1ght committed Apr 22, 2023
1 parent ce67004 commit 4d0be43
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/components/Boost.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script>
import axios from 'axios';
import axiosRetry from 'axios-retry';
import QRCode from 'qrcode';
import OutClick from 'svelte-outclick';
import { LottiePlayer } from '@lottiefiles/svelte-lottie-player';
Expand Down Expand Up @@ -50,9 +49,6 @@
const jsConfetti = new JSConfetti();
document.querySelector('canvas').style.zIndex = '2001';
const boostRetry = axios.create();
axiosRetry(boostRetry, { retries: 3 });
const checkInvoice = () => {
axios
.get(`/boost/invoice/status?hash=${hash}`)
Expand All @@ -65,7 +61,7 @@
}
$boostHash = hash;
boostRetry
axios
.post('/boost/post', {
element: $boost.id,
time: selectedBoost.time,
Expand Down
3 changes: 3 additions & 0 deletions src/lib/map/setup.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import Time from 'svelte-time';
import axios from 'axios';
import axiosRetry from 'axios-retry';
import { boost, exchangeRate, resetBoost, showTags, showMore, theme } from '$lib/store';
import { get } from 'svelte/store';
import { errToast, detectTheme } from '$lib/utils';
import { InfoTooltip } from '$comp';

axiosRetry(axios, { retries: 3 });

export const toggleMapButtons = () => {
const zoomInBtn = document.querySelector('.leaflet-control-zoom-in');
const zoomOutBtn = document.querySelector('.leaflet-control-zoom-out');
Expand Down
3 changes: 3 additions & 0 deletions src/routes/add-location/endpoint/+server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios from 'axios';
import axiosRetry from 'axios-retry';
import crypto from 'crypto';
import {
GITHUB_API_KEY,
Expand All @@ -8,6 +9,8 @@ import {
} from '$env/static/private';
import { error } from '@sveltejs/kit';

axiosRetry(axios, { retries: 3 });

let used = [];

export async function POST({ request }) {
Expand Down
3 changes: 3 additions & 0 deletions src/routes/boost/invoice/generate/+server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import axios from 'axios';
import axiosRetry from 'axios-retry';
import { LNBITS_URL, LNBITS_API_KEY } from '$env/static/private';
import { error } from '@sveltejs/kit';

axiosRetry(axios, { retries: 3 });

// generate and return invoice
export async function GET({ url }) {
let amount = url.searchParams.get('amount');
Expand Down
3 changes: 3 additions & 0 deletions src/routes/boost/post/+server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import axios from 'axios';
import axiosRetry from 'axios-retry';
import { BTCMAP_KEY } from '$env/static/private';
import { error, json } from '@sveltejs/kit';

axiosRetry(axios, { retries: 3 });

let used = [];

export async function POST({ request }) {
Expand Down
3 changes: 3 additions & 0 deletions src/routes/communities/add/endpoint/+server.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import axios from 'axios';
import axiosRetry from 'axios-retry';
import crypto from 'crypto';
import { GITHUB_API_KEY, SERVER_CRYPTO_KEY, SERVER_INIT_VECTOR } from '$env/static/private';
import { error } from '@sveltejs/kit';

axiosRetry(axios, { retries: 3 });

let used = [];

export async function POST({ request }) {
Expand Down
3 changes: 3 additions & 0 deletions src/routes/community/[area]/+page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import axios from 'axios';
import axiosRetry from 'axios-retry';
import { error } from '@sveltejs/kit';

axiosRetry(axios, { retries: 3 });

export async function load({ params }) {
let { area } = params;
try {
Expand Down
3 changes: 3 additions & 0 deletions src/routes/tagger/[id]/+page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import axios from 'axios';
import axiosRetry from 'axios-retry';
import { error } from '@sveltejs/kit';

axiosRetry(axios, { retries: 3 });

export async function load({ params }) {
let { id } = params;

Expand Down
3 changes: 3 additions & 0 deletions src/routes/tickets/endpoint/+server.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import axios from 'axios';
import axiosRetry from 'axios-retry';
import { json } from '@sveltejs/kit';
import { GITHUB_API_KEY } from '$env/static/private';

axiosRetry(axios, { retries: 3 });

export async function GET() {
const headers = {
Authorization: `Bearer ${GITHUB_API_KEY}`,
Expand Down
3 changes: 3 additions & 0 deletions src/routes/verify-location/endpoint/+server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios from 'axios';
import axiosRetry from 'axios-retry';
import crypto from 'crypto';
import {
GITHUB_API_KEY,
Expand All @@ -8,6 +9,8 @@ import {
} from '$env/static/private';
import { error } from '@sveltejs/kit';

axiosRetry(axios, { retries: 3 });

let used = [];

export async function POST({ request }) {
Expand Down

0 comments on commit 4d0be43

Please sign in to comment.