diff --git a/app/frontend/components/auth/login.py b/app/frontend/components/auth/login.py index 8f2b6562f305f29dbbc34c45bdfbf4232f304571..b0290ccc7ed78a9cf64abdc2df55d0b128652413 100644 --- a/app/frontend/components/auth/login.py +++ b/app/frontend/components/auth/login.py @@ -2,7 +2,7 @@ import customtkinter as ctk from tkinter import messagebox import requests -def login_frame(parent, switch_func, api_url): +def login_frame(parent, switch_func, API_URL): frame = ctk.CTkFrame(parent) def login(): @@ -14,7 +14,7 @@ def login_frame(parent, switch_func, api_url): return response = requests.post( - f"{api_url}/auth/login", json={"email": email, "password": password} + f"{API_URL}/auth/login", json={"email": email, "password": password} ) try: diff --git a/app/frontend/components/auth/register.py b/app/frontend/components/auth/register.py index 3223abf01b43d8186a43acf971e8cd49e06c0bb6..64b238bd37104d86d5af8899e35d8d96c1b259f5 100644 --- a/app/frontend/components/auth/register.py +++ b/app/frontend/components/auth/register.py @@ -2,7 +2,7 @@ import customtkinter as ctk from tkinter import messagebox import requests -def register_frame(parent, switch_func, api_url): +def register_frame(parent, switch_func, API_URL): frame = ctk.CTkFrame(parent) def register(): @@ -21,7 +21,7 @@ def register_frame(parent, switch_func, api_url): return response = requests.post( - f"{api_url}/auth/signup", + f"{API_URL}/auth/signup", json={"username": username, "email": email, "phone_number": phone_number, "password": password}, ) diff --git a/app/frontend/components/shop/create_shop.py b/app/frontend/components/shop/create_shop.py index 14a44a3dc78b78609f562b406814f368a6871e8b..d7ac4e3311b212f85e417875515b8ae8f1aeabf1 100644 --- a/app/frontend/components/shop/create_shop.py +++ b/app/frontend/components/shop/create_shop.py @@ -4,7 +4,7 @@ import requests import os -def create_shop_frame(parent, switch_func, api_url, token): +def create_shop_frame(parent, switch_func, API_URL, token): frame = ctk.CTkFrame(parent) selected_file_path = [None] @@ -26,7 +26,7 @@ def create_shop_frame(parent, switch_func, api_url, token): messagebox.showwarning("Input Error", "Shop name is required!") return - url = f"{api_url}/shops" + url = f"{API_URL}/shops" data = {"name": name, "description": description} files = {} diff --git a/app/frontend/components/shop/view_shop.py b/app/frontend/components/shop/view_shop.py index 960fec4a41d5e5c0d6d75518d6500eff5f17d6d4..2c103142a9f43cf307a3b782649bb09708857546 100644 --- a/app/frontend/components/shop/view_shop.py +++ b/app/frontend/components/shop/view_shop.py @@ -4,7 +4,7 @@ from tkinter import messagebox from PIL import Image, ImageTk import io -def view_shop_frame(parent, switch_func, api_url, token): +def view_shop_frame(parent, switch_func, API_URL, token): frame = ctk.CTkFrame(parent) # Title @@ -29,7 +29,7 @@ def view_shop_frame(parent, switch_func, api_url, token): """ Fetch the shop created by the logged-in user """ headers = {"Authorization": f"Bearer {token}"} try: - response = requests.get(f"{api_url}/shops/my-shop", headers=headers) # Adjust the endpoint as needed + response = requests.get(f"{API_URL}/shops/my-shop", headers=headers) # Adjust the endpoint as needed if response.status_code == 200: shop_data = response.json() shop_name_label.configure(text=f"Shop Name: {shop_data['name']}") @@ -58,7 +58,7 @@ def view_shop_frame(parent, switch_func, api_url, token): """ Fetch products that belong to the user's shop """ headers = {"Authorization": f"Bearer {token}"} try: - response = requests.get(f"{api_url}/products?shop_id={shop_id}", headers=headers) + response = requests.get(f"{API_URL}/products?shop_id={shop_id}", headers=headers) if response.status_code == 200: products = response.json() display_products(products)