From b89e2ade333aa6050bedc31f340d52070233a754 Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Tue, 17 Jun 2025 10:44:45 +0700 Subject: [PATCH] untuk menghindari masalah CORS --- handler.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/handler.py b/handler.py index 7e54be6..1d3b678 100644 --- a/handler.py +++ b/handler.py @@ -41,8 +41,10 @@ def list(crud): db_main = mariadb.connect(**database.db_main) cursor = db_main.cursor(dictionary=True) - - if crud == "create": + + if request.method == 'OPTIONS': + return None + elif crud == "create": name = params["name" ] phone = params["phone" ] cursor.execute("INSERT INTO `member` VALUES (DEFAULT, %s, %s) ;" , (name, phone) )