don't overwrite organization

This commit is contained in:
Nate 2025-07-15 17:56:58 -07:00
parent 304d1ac0a3
commit ae77d34d90

View file

@ -137,6 +137,9 @@ function getAuthUrlForTokenPage(useOnboarding: boolean = false): string {
*/
async function refreshToken(refreshToken: string): Promise<AuthConfig> {
try {
// Load existing config to preserve organizationId and other fields
const existingConfig = loadAuthConfig();
const response = await axios.post(
new URL("auth/refresh", env.apiBase).toString(),
{
@ -150,6 +153,7 @@ async function refreshToken(refreshToken: string): Promise<AuthConfig> {
const tokenExpiresAt = Date.now() + 60 * 60 * 1000;
const authConfig: AuthConfig = {
...existingConfig, // Preserve existing fields like organizationId
userId: user.id,
userEmail: user.email,
accessToken,
@ -415,4 +419,4 @@ export function logout(): void {
} else {
console.info(chalk.yellow("No active session found"));
}
}
}