feat: system tools and admin enhancements
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { createContext, useContext, useMemo, useState, useEffect } from 'react'
|
||||
import { login as apiLogin } from '../api/client'
|
||||
import { login as apiLogin, logoutUser } from '../api/client'
|
||||
|
||||
const AuthContext = createContext(null)
|
||||
|
||||
@@ -46,7 +46,12 @@ export function AuthProvider({ children }) {
|
||||
setToken(data.token)
|
||||
setEmail(data.email || loginInput)
|
||||
},
|
||||
logout() {
|
||||
async logout() {
|
||||
try {
|
||||
await logoutUser()
|
||||
} catch {
|
||||
// Ignore logout failures; client state is cleared regardless.
|
||||
}
|
||||
localStorage.removeItem('speedbb_token')
|
||||
localStorage.removeItem('speedbb_email')
|
||||
localStorage.removeItem('speedbb_user_id')
|
||||
|
||||
Reference in New Issue
Block a user