MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / updatePlaylist

Method updatePlaylist

frontend/src/api.js:1501–1551  ·  view source on GitHub ↗
(values, isToggle = false)

Source from the content-addressed store, hash-verified

1499 }
1500
1501 static async updatePlaylist(values, isToggle = false) {
1502 const { id, ...payload } = values;
1503
1504 try {
1505 // If this is just toggling the active state, make a simpler request
1506 if (
1507 isToggle &&
1508 'is_active' in payload &&
1509 Object.keys(payload).length === 1
1510 ) {
1511 const response = await request(`${host}/api/m3u/accounts/${id}/`, {
1512 method: 'PATCH',
1513 body: { is_active: payload.is_active },
1514 });
1515
1516 usePlaylistsStore.getState().updatePlaylist(response);
1517 return response;
1518 }
1519
1520 // Original implementation for full updates
1521 let body = null;
1522 if (payload.file) {
1523 delete payload.server_url;
1524
1525 body = new FormData();
1526 for (const prop in values) {
1527 if (values[prop] === null || values[prop] === undefined) continue;
1528 body.append(prop, values[prop]);
1529 }
1530 } else {
1531 delete payload.file;
1532 if (!payload.server_url) {
1533 delete payload.sever_url;
1534 }
1535
1536 body = { ...payload };
1537 delete body.file;
1538 }
1539
1540 const response = await request(`${host}/api/m3u/accounts/${id}/`, {
1541 method: 'PATCH',
1542 body,
1543 });
1544
1545 usePlaylistsStore.getState().updatePlaylist(response);
1546
1547 return response;
1548 } catch (e) {
1549 errorNotification(`Failed to update M3U account ${id}`, e);
1550 }
1551 }
1552
1553 static async getEPGs() {
1554 try {

Callers 6

deleteM3UProfileMethod · 0.80
updateM3UProfileMethod · 0.80
toggleActiveFunction · 0.80
updatePlaylistFunction · 0.80
playlists.test.jsxFile · 0.80

Calls 3

requestFunction · 0.85
errorNotificationFunction · 0.85
keysMethod · 0.80

Tested by

no test coverage detected