Fix issues when testing notifications

pull/1383/head
LASER-Yi 4 years ago
parent 56958488b6
commit 385cc214b3

@ -377,14 +377,13 @@ class LanguagesProfiles(Resource):
class Notifications(Resource):
@authenticate
def patch(self):
protocol = request.form.get("protocol")
path = request.form.get("path")
url = request.form.get("url")
asset = apprise.AppriseAsset(async_mode=False)
apobj = apprise.Apprise(asset=asset)
apobj.add(f"{protocol}://{path}")
apobj.add(url)
apobj.notify(
title='Bazarr test notification',

@ -84,7 +84,7 @@ const NotificationModal: FunctionComponent<ModalProps & BaseModalProps> = ({
variant="outline-secondary"
promise={() => {
if (current && current.url) {
return SystemApi.testNotification(current.name, current.url);
return SystemApi.testNotification(current.url);
} else {
return null;
}

@ -137,9 +137,9 @@ class SystemApi extends BaseApi {
});
}
async testNotification(protocol: string, path: string) {
async testNotification(url: string) {
return new Promise<void>((resolve, reject) => {
this.patch<void>("/notifications", { protocol, path })
this.patch<void>("/notifications", { url })
.then(() => resolve())
.catch(reject);
});

Loading…
Cancel
Save