src/shared/api/index.ts   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 12
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 9
mnd 1
bc 1
fnc 0
dl 0
loc 12
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
1
const fetchData = (url: string) =>
2
  fetch(url)
3
    .then(res => {
4
      if (!res.ok) {
5
        throw new Error('Fiasco when trying to fetch data')
6
        // https://react-query.tanstack.com/guides/query-functions#usage-with-fetch-and-other-clients-that-do-not-throw-by-default
7
      }
8
      return res.json()
9
    })
10
    .catch(console.error)
11
12
export { fetchData }
13