From 3258a56c1145f017ae565d1d14f8f2d94c795faa Mon Sep 17 00:00:00 2001 From: Sviatoslav Bar Date: Thu, 25 Jul 2024 16:23:21 +0300 Subject: [PATCH] fix/ error in ringtone GET request [WTEL-4791] --- src/modules/settings/api/settings.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/settings/api/settings.js b/src/modules/settings/api/settings.js index 2d85bb013..f5aa05cc5 100644 --- a/src/modules/settings/api/settings.js +++ b/src/modules/settings/api/settings.js @@ -48,10 +48,11 @@ export const changeWebPhone = async (changes) => { export const getRingtonesList = async () => { const url = `${import.meta.env.VITE_RINGTONES_URL}/index.json`; try { - const ringtones = await fetch(url) - .then((res) => { - if(res && res.ok) res.json() - }); + const response = await fetch(url); + if (!response.ok) { + throw new Error('Response from \'...ringtones/index.json\' was not ok'); + } + const ringtones = await response.json(); return ringtones.ringtones; } catch (err) { throw applyTransform(err, [