Skip to content

Commit

Permalink
fix/ error in ringtone GET request [WTEL-4791]
Browse files Browse the repository at this point in the history
  • Loading branch information
SviatoslavBar committed Jul 25, 2024
1 parent 29d52cb commit 3258a56
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/modules/settings/api/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, [
Expand Down

0 comments on commit 3258a56

Please sign in to comment.