Rename logout to reset and clear all localStorage
- Renamed "Log Out" button to "Reset All Data" to better reflect functionality - Renamed handleLogout to handleReset for consistency - Updated confirmation dialog text to say "reset the application" - Replaced selective localStorage clearing with localStorage.clear() for complete data removal - Ensures all conversations, authentication, and MCP data is properly cleared 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
253db5ebc1
commit
6605fbcab6
1 changed files with 16 additions and 14 deletions
|
|
@ -20,24 +20,26 @@ export function ConversationSidebar() {
|
||||||
createConversation();
|
createConversation();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleLogout = () => {
|
const handleReset = () => {
|
||||||
if (confirm('Are you sure you want to log out? This will disconnect all MCP servers and clear your authentication.')) {
|
if (confirm('Are you sure you want to reset the application? This will clear all data including conversations, authentication, and server connections.')) {
|
||||||
// Clear inference provider authentication
|
// Clear inference provider authentication
|
||||||
clearProvider();
|
clearProvider();
|
||||||
|
|
||||||
// Clear MCP OAuth tokens for all connections
|
|
||||||
connections.forEach(connection => {
|
|
||||||
if (connection.authType === 'oauth') {
|
|
||||||
// Clear OAuth tokens and state for this connection
|
|
||||||
localStorage.removeItem(`mcp_oauth_tokens_${connection.id}`);
|
|
||||||
localStorage.removeItem(`mcp_oauth_state_${connection.id}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Remove all MCP servers (this will disconnect them)
|
// Remove all MCP servers (this will disconnect them)
|
||||||
connections.forEach(connection => {
|
connections.forEach(connection => {
|
||||||
removeMcpServer(connection.id);
|
removeMcpServer(connection.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Clear all conversations
|
||||||
|
conversations.forEach(conversation => {
|
||||||
|
deleteConversation(conversation.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Clear ALL localStorage data
|
||||||
|
localStorage.clear();
|
||||||
|
|
||||||
|
// Refresh the page to ensure clean state
|
||||||
|
window.location.reload();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -142,14 +144,14 @@ export function ConversationSidebar() {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Logout Button */}
|
{/* Reset Button */}
|
||||||
{provider && (
|
{provider && (
|
||||||
<div className="p-4 border-t border-gray-200 dark:border-gray-700">
|
<div className="p-4 border-t border-gray-200 dark:border-gray-700">
|
||||||
<button
|
<button
|
||||||
onClick={handleLogout}
|
onClick={handleReset}
|
||||||
className="w-full px-4 py-2 text-sm bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors"
|
className="w-full px-4 py-2 text-sm bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors"
|
||||||
>
|
>
|
||||||
Log Out
|
Reset All Data
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue