-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
How are you running AnythingLLM?
All versions
What happened?
The Auth context provider is exported as ContextWrapper, which is not a clear or descriptive name. It should be exported as AuthProvider.
Relevant code references:
anything-llm/frontend/src/AuthContext.jsx
Lines 5 to 32 in 89a0149
| export function ContextWrapper(props) { | |
| const localUser = localStorage.getItem(AUTH_USER); | |
| const localAuthToken = localStorage.getItem(AUTH_TOKEN); | |
| const [store, setStore] = useState({ | |
| user: localUser ? JSON.parse(localUser) : null, | |
| authToken: localAuthToken ? localAuthToken : null, | |
| }); | |
| const [actions] = useState({ | |
| updateUser: (user, authToken = "") => { | |
| localStorage.setItem(AUTH_USER, JSON.stringify(user)); | |
| localStorage.setItem(AUTH_TOKEN, authToken); | |
| setStore({ user, authToken }); | |
| }, | |
| unsetUser: () => { | |
| localStorage.removeItem(AUTH_USER); | |
| localStorage.removeItem(AUTH_TOKEN); | |
| localStorage.removeItem(AUTH_TIMESTAMP); | |
| setStore({ user: null, authToken: null }); | |
| }, | |
| }); | |
| return ( | |
| <AuthContext.Provider value={{ store, actions }}> | |
| {props.children} | |
| </AuthContext.Provider> | |
| ); | |
| } |
anything-llm/frontend/src/App.jsx
Lines 100 to 101 in 89a0149
| <ContextWrapper> | |
| <LogoProvider> |
Are there known steps to reproduce?
- Open
frontend/src/AuthContext.jsx. - See that the provider is exported as
ContextWrapper.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers