Fix issues when testing notifications

This commit is contained in:
LASER-Yi 2021-04-16 00:46:19 +08:00
parent 56958488b6
commit 385cc214b3
3 changed files with 5 additions and 6 deletions

View File

@ -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',

View File

@ -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;
}

View File

@ -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);
});