From 51f5f44e316d015e2f1ca25d5fb2d6cd0f6418e1 Mon Sep 17 00:00:00 2001 From: Tanmoy Sarkar <57363826+tanmoysrt@users.noreply.github.com> Date: Fri, 5 Jan 2024 08:58:16 +0530 Subject: [PATCH] chore: remove commit and move apis to POST --- frappe/push_notification.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frappe/push_notification.py b/frappe/push_notification.py index 274b65fdeb..b46902925a 100644 --- a/frappe/push_notification.py +++ b/frappe/push_notification.py @@ -206,7 +206,6 @@ class PushNotification: notification_settings.api_key = response["credentials"]["api_key"] notification_settings.api_secret = response["credentials"]["api_secret"] notification_settings.save(ignore_permissions=True) - frappe.db.commit() return notification_settings.api_key, notification_settings.api_secret def _send_post_request(self, method: str, params: dict, use_authentication: bool = True): @@ -269,13 +268,13 @@ def auth_webhook(): # Subscribe and Unsubscribe API -@frappe.whitelist(methods=["GET"]) +@frappe.whitelist(methods=["POST"]) def subscribe(fcm_token: str): success, message = PushNotification().add_token(frappe.session.user, fcm_token) return {"success": success, "message": message} -@frappe.whitelist(methods=["GET"]) +@frappe.whitelist(methods=["POST"]) def unsubscribe(fcm_token: str): success, message = PushNotification().remove_token(frappe.session.user, fcm_token) return {"success": success, "message": message}