You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ms...@apache.org on 2025/10/22 16:54:34 UTC
(superset) branch master updated: fix(ThemeController): replace fetch with SupersetClient for proper auth (#35794)
This is an automated email from the ASF dual-hosted git repository.
msyavuz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 7f0c0aea94 fix(ThemeController): replace fetch with SupersetClient for proper auth (#35794)
7f0c0aea94 is described below
commit 7f0c0aea94808abe63bc5a705528ecf41b6c8e88
Author: Mehmet Salih Yavuz <sa...@proton.me>
AuthorDate: Wed Oct 22 19:54:28 2025 +0300
fix(ThemeController): replace fetch with SupersetClient for proper auth (#35794)
---
superset-frontend/src/theme/ThemeController.ts | 30 ++++++++++++++------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/superset-frontend/src/theme/ThemeController.ts b/superset-frontend/src/theme/ThemeController.ts
index 3cd4a1523b..22e2bd02c5 100644
--- a/superset-frontend/src/theme/ThemeController.ts
+++ b/superset-frontend/src/theme/ThemeController.ts
@@ -22,6 +22,7 @@ import {
type ThemeControllerOptions,
type ThemeStorage,
isThemeConfigDark,
+ makeApi,
Theme,
ThemeMode,
themeObject as supersetThemeObject,
@@ -225,14 +226,14 @@ export class ThemeController {
return this.dashboardThemes.get(themeId)!;
}
- // Fetch theme config from API
- const response = await fetch(`/api/v1/theme/${themeId}`);
- if (!response.ok) {
- throw new Error(`HTTP ${response.status}: ${response.statusText}`);
- }
+ // Fetch theme config from API using SupersetClient for proper auth
+ const getTheme = makeApi<void, { result: { json_data: string } }>({
+ method: 'GET',
+ endpoint: `/api/v1/theme/${themeId}`,
+ });
- const data = await response.json();
- const themeConfig = JSON.parse(data.result.json_data);
+ const { result } = await getTheme();
+ const themeConfig = JSON.parse(result.json_data);
if (themeConfig) {
// Controller creates and owns the dashboard theme
@@ -861,13 +862,14 @@ export class ThemeController {
themeId: string,
): Promise<AnyThemeConfig | null> {
try {
- const response = await fetch(`/api/v1/theme/${themeId}`);
- if (!response.ok) {
- throw new Error(`HTTP ${response.status}: ${response.statusText}`);
- }
-
- const data = await response.json();
- const themeConfig = JSON.parse(data.result.json_data);
+ // Use SupersetClient for proper authentication handling
+ const getTheme = makeApi<void, { result: { json_data: string } }>({
+ method: 'GET',
+ endpoint: `/api/v1/theme/${themeId}`,
+ });
+
+ const { result } = await getTheme();
+ const themeConfig = JSON.parse(result.json_data);
return themeConfig;
} catch (error) {