**Commit Message:**
Enhance app with active pgroup handling and token updates Added active pgroup state management across the app for user-specific settings. Improved token handling with decoding, saving user data, and setting OpenAPI authorization. Updated components, API calls, and forms to support dynamic pgroup selection and user-specific features.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import {OpenAPI} from "../../openapi";
|
||||
|
||||
export const setUpToken = (): void => {
|
||||
const token = localStorage.getItem('token');
|
||||
if (token) {
|
||||
OpenAPI.TOKEN = token; // Assign the token to OpenAPI client
|
||||
} else {
|
||||
console.warn("No token found in localStorage.");
|
||||
}
|
||||
};
|
||||
|
||||
export const clearToken = (): void => {
|
||||
localStorage.removeItem('token');
|
||||
OpenAPI.TOKEN = ''; // Clear the token from the OpenAPI client
|
||||
console.log("Token cleared from OpenAPI and localStorage.");
|
||||
};
|
||||
Reference in New Issue
Block a user