Merged in feat/sw-3623-fetchretry (pull request #3180)

feat(SW_3623): remove fetch-retry

* feat(SW_3623): remove fetch-retry


Approved-by: Joakim Jäderberg
This commit is contained in:
Linus Flood
2025-11-20 13:24:34 +00:00
parent c60f7928ba
commit 5eaaea527f
4 changed files with 6 additions and 30 deletions

View File

@@ -1,5 +1,4 @@
import merge from "deepmerge"
import fetchRetry from "fetch-retry"
import { env } from "../../env/server"
@@ -24,13 +23,6 @@ const defaultOptions: RequestInit = {
mode: "cors",
}
const wrappedFetch = fetchRetry(fetch, {
retries: 2,
retryDelay: function (attempt) {
return Math.pow(2, attempt) * 150 // 150, 300, 600
},
})
export async function get(
endpoint: Endpoint,
options: RequestOptionsWithOutBody,
@@ -40,7 +32,7 @@ export async function get(
url.pathname = endpoint
url.search = new URLSearchParams(params).toString()
return wrappedFetch(url, {
return fetch(url, {
...merge.all([defaultOptions, { method: "GET" }, options]),
signal: AbortSignal.timeout(15_000),
})
@@ -55,7 +47,7 @@ export async function patch(
const url = new URL(env.API_BASEURL)
url.pathname = endpoint
url.search = new URLSearchParams(params).toString()
return wrappedFetch(url, {
return fetch(url, {
...merge.all([
defaultOptions,
{ body: JSON.stringify(body), method: "PATCH" },
@@ -74,7 +66,7 @@ export async function post(
const url = new URL(env.API_BASEURL)
url.pathname = endpoint
url.search = new URLSearchParams(params).toString()
return wrappedFetch(url, {
return fetch(url, {
...merge.all([
defaultOptions,
{ body: JSON.stringify(body), method: "POST" },
@@ -93,7 +85,7 @@ export async function put(
const url = new URL(env.API_BASEURL)
url.pathname = endpoint
url.search = new URLSearchParams(params).toString()
return wrappedFetch(url, {
return fetch(url, {
...merge.all([
defaultOptions,
{ body: JSON.stringify(body), method: "PUT" },
@@ -112,7 +104,7 @@ export async function remove(
const url = new URL(env.API_BASEURL)
url.pathname = endpoint
url.search = new URLSearchParams(params).toString()
return wrappedFetch(url, {
return fetch(url, {
...merge.all([
defaultOptions,
{ body: JSON.stringify(body), method: "DELETE" },