mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-19 00:01:19 +00:00
27 lines
674 B
TypeScript
27 lines
674 B
TypeScript
import { clearToken, hasToken, getCredentialsPath } from "@/lib/storage/index.js"
|
|
|
|
export interface LogoutOptions {
|
|
verbose?: boolean
|
|
}
|
|
|
|
export interface LogoutResult {
|
|
success: boolean
|
|
wasLoggedIn: boolean
|
|
}
|
|
|
|
export async function logout({ verbose = false }: LogoutOptions = {}): Promise<LogoutResult> {
|
|
const wasLoggedIn = await hasToken()
|
|
|
|
if (!wasLoggedIn) {
|
|
console.log("You are not currently logged in.")
|
|
return { success: true, wasLoggedIn: false }
|
|
}
|
|
|
|
if (verbose) {
|
|
console.log(`[Auth] Removing credentials from ${getCredentialsPath()}`)
|
|
}
|
|
|
|
await clearToken()
|
|
console.log("✓ Successfully logged out")
|
|
return { success: true, wasLoggedIn: true }
|
|
}
|