MCPcopy Index your code
hub / github.com/Dispatcharr/Dispatcharr / updateChannel

Method updateChannel

frontend/src/api.js:656–711  ·  view source on GitHub ↗
(values)

Source from the content-addressed store, hash-verified

654 }
655
656 static async updateChannel(values) {
657 try {
658 // Clean up values before sending to API
659 const payload = { ...values };
660
661 // Handle special values
662 if (
663 payload.stream_profile_id === '0' ||
664 payload.stream_profile_id === 0
665 ) {
666 payload.stream_profile_id = null;
667 }
668
669 // Handle logo_id properly (0 means "no logo")
670 if (payload.logo_id === '0' || payload.logo_id === 0) {
671 payload.logo_id = null;
672 }
673
674 // Ensure tvg_id is included properly (not as empty string)
675 if (payload.tvg_id === '') {
676 payload.tvg_id = null;
677 }
678
679 // Ensure tvc_guide_stationid is included properly (not as empty string)
680 if (payload.tvc_guide_stationid === '') {
681 payload.tvc_guide_stationid = null;
682 }
683
684 // Handle channel_number properly
685 if (payload.channel_number === '') {
686 payload.channel_number = null;
687 } else if (
688 payload.channel_number !== null &&
689 payload.channel_number !== undefined
690 ) {
691 // Ensure channel_number is explicitly treated as a float
692 payload.channel_number = parseFloat(payload.channel_number);
693 }
694
695 const response = await request(
696 `${host}/api/channels/channels/${payload.id}/`,
697 {
698 method: 'PATCH',
699 body: payload,
700 }
701 );
702
703 useChannelsStore.getState().updateChannel(response);
704 if (Object.prototype.hasOwnProperty.call(payload, 'streams')) {
705 await API.requeryStreams();
706 }
707 return response;
708 } catch (e) {
709 errorNotification('Failed to update channel', e);
710 }
711 }
712
713 /**

Callers 14

WebsocketProviderFunction · 0.80
reorderChannelStreamsMethod · 0.80
addStreamsToChannelMethod · 0.80
setChannelEPGMethod · 0.80
matchChannelEpgMethod · 0.80
EditableTextCellInnerFunction · 0.80
EditableNumberCellInnerFunction · 0.80
EditableGroupCellInnerFunction · 0.80
EditableEPGCellInnerFunction · 0.80
EditableLogoCellInnerFunction · 0.80
updateChannelFunction · 0.80
clearChannelOverridesFunction · 0.80

Calls 3

requestFunction · 0.85
errorNotificationFunction · 0.85
requeryStreamsMethod · 0.80

Tested by

no test coverage detected