mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-18 00:55:50 +00:00
fixed match epg, centralized to api
This commit is contained in:
parent
8d20fb8fe0
commit
8ca91bd897
2 changed files with 19 additions and 14 deletions
|
|
@ -856,4 +856,17 @@ export default class API {
|
|||
const retval = await response.json();
|
||||
return retval;
|
||||
}
|
||||
|
||||
static async matchEpg() {
|
||||
const response = await fetch(`${host}/api/channels/channels/match-epg/`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${await API.getAuthToken()}`,
|
||||
},
|
||||
});
|
||||
|
||||
const retval = await response.json();
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -376,22 +376,14 @@ const ChannelsTable = ({}) => {
|
|||
const matchEpg = async () => {
|
||||
try {
|
||||
// Hit our new endpoint that triggers the fuzzy matching Celery task
|
||||
const resp = await fetch('/api/channels/channels/match-epg/', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${await API.getAuthToken()}`,
|
||||
},
|
||||
});
|
||||
await API.matchEpg();
|
||||
|
||||
if (resp.ok) {
|
||||
showAlert('EPG matching task started!');
|
||||
} else {
|
||||
const text = await resp.text();
|
||||
showAlert(`Failed to start EPG matching: ${text}`);
|
||||
}
|
||||
notifications.show({
|
||||
title: 'EPG matching task started!',
|
||||
// style: { width: '200px', left: '200px' },
|
||||
});
|
||||
} catch (err) {
|
||||
showAlert(`Error: ${err.message}`);
|
||||
notifications.show(`Error: ${err.message}`);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue