Skip to content

Commit 200a977

Browse files
fix(ui): use installation target from initial state in authcontext (#2458)
* use installation target from initial state in authcontext * more context in comment
1 parent 3819c8e commit 200a977

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

web/src/contexts/AuthContext.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ children
3636
// Check token validity on mount and when token changes
3737
useEffect(() => {
3838
if (token) {
39+
// Get the installation target from initial state
40+
const initialState = window.__INITIAL_STATE__ || {};
41+
const target = initialState.installTarget;
42+
3943
// Make a request to any authenticated endpoint to check token validity
40-
fetch("/api/linux/install/installation/config", {
44+
// Use the correct target-specific endpoint based on installation target
45+
fetch(`/api/${target}/install/installation/config`, {
4146
headers: {
4247
Authorization: `Bearer ${token}`,
4348
},

0 commit comments

Comments
 (0)