From 6264150592409aed3a0390a6c2da75928c9e9878 Mon Sep 17 00:00:00 2001 From: "lalitdeore12@gmail.com" Date: Thu, 22 May 2025 14:26:13 +0530 Subject: [PATCH] remove extra api for changing theme --- backend/go-app/main.go | 1 - frontend/src/components/LeftSideBar.jsx | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/go-app/main.go b/backend/go-app/main.go index 06021b6b..2e1cf238 100755 --- a/backend/go-app/main.go +++ b/backend/go-app/main.go @@ -5103,7 +5103,6 @@ func initHandlers() { r.HandleFunc("/api/v1/users/{key}/get2fa", shuffle.HandleGet2fa).Methods("GET", "OPTIONS") r.HandleFunc("/api/v1/users/{key}/set2fa", shuffle.HandleSet2fa).Methods("POST", "OPTIONS") r.HandleFunc("/api/v1/users", shuffle.HandleGetUsers).Methods("GET", "OPTIONS") - r.HandleFunc("/api/v1/users/{userid}/theme", shuffle.HandleSetUserTheme).Methods("POST", "OPTIONS") // General - duplicates and old. r.HandleFunc("/api/v1/getusers", shuffle.HandleGetUsers).Methods("GET", "OPTIONS") diff --git a/frontend/src/components/LeftSideBar.jsx b/frontend/src/components/LeftSideBar.jsx index db93754b..39fce780 100644 --- a/frontend/src/components/LeftSideBar.jsx +++ b/frontend/src/components/LeftSideBar.jsx @@ -450,15 +450,16 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => { }; const handleUpdateTheme = (newTheme) => { - + const data = { + "user_id": userdata?.id, "theme": newTheme, } - const url = globalUrl + `/api/v1/users/${userdata?.id}/theme`; + const url = globalUrl + `/api/v1/users/updateuser`; fetch(url, { mode: "cors", - method: "POST", + method: "PUT", body: JSON.stringify(data), credentials: "include", crossDomain: true,