Fix issue where on page refresh when on function edit/new sub pages you would be redirected back to dashboard

This commit is contained in:
Peter Stockings
2024-03-27 14:03:52 +11:00
parent 48b013c1f4
commit 1a496d2441
10 changed files with 89 additions and 52 deletions

5
db.py
View File

@@ -57,6 +57,11 @@ class DataBase():
'SELECT id, user_id, NAME, script_content, invoked_count, environment_info, is_public, log_request, log_response FROM http_functions WHERE user_id=%s AND NAME=%s', [user_id, name], one=True)
return http_function
def get_http_function_by_id(self, user_id, http_function_id):
http_function = self.execute(
'SELECT id, user_id, NAME, script_content, invoked_count, environment_info, is_public, log_request, log_response FROM http_functions WHERE user_id=%s AND id=%s', [user_id, http_function_id], one=True)
return http_function
def create_new_http_function(self, user_id, name, script_content, environment_info, is_public, log_request, log_response):
self.execute(
'INSERT INTO http_functions (user_id, NAME, script_content, environment_info, is_public, log_request, log_response) VALUES (%s, %s, %s, %s, %s, %s, %s)',