(values)
| 1405 | } |
| 1406 | |
| 1407 | static async addPlaylist(values) { |
| 1408 | try { |
| 1409 | let body = null; |
| 1410 | if (values.file) { |
| 1411 | body = new FormData(); |
| 1412 | for (const prop in values) { |
| 1413 | if (values[prop] === null || values[prop] === undefined) continue; |
| 1414 | body.append(prop, values[prop]); |
| 1415 | } |
| 1416 | } else { |
| 1417 | body = { ...values }; |
| 1418 | delete body.file; |
| 1419 | } |
| 1420 | |
| 1421 | const response = await request(`${host}/api/m3u/accounts/`, { |
| 1422 | method: 'POST', |
| 1423 | body, |
| 1424 | }); |
| 1425 | |
| 1426 | usePlaylistsStore.getState().addPlaylist(response); |
| 1427 | |
| 1428 | return response; |
| 1429 | } catch (e) { |
| 1430 | errorNotification('Failed to create M3U account', e); |
| 1431 | } |
| 1432 | } |
| 1433 | |
| 1434 | static async refreshPlaylist(id) { |
| 1435 | try { |
no test coverage detected