more fixes for refresh token - this time maintaining the username and role properly across refresh
This commit is contained in:
parent
7e45a0c016
commit
0910ade371
6 changed files with 11 additions and 3 deletions
Binary file not shown.
|
|
@ -150,7 +150,9 @@ async def refresh_token(
|
|||
return RefreshResponse(
|
||||
access_token=new_access_token,
|
||||
user_id=user_id,
|
||||
role=user.role if isinstance(user.role, str) else user.role.value
|
||||
role=user.role if isinstance(user.role, str) else user.role.value,
|
||||
email=user.email,
|
||||
full_name=user.full_name
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -18,6 +18,10 @@ class LoginResponse(BaseModel):
|
|||
class RefreshResponse(BaseModel):
|
||||
access_token: str
|
||||
token_type: str = "bearer"
|
||||
user_id: str
|
||||
role: str
|
||||
email: str
|
||||
full_name: str
|
||||
|
||||
|
||||
class LogoutResponse(BaseModel):
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ export const useAuthStore = create<AuthState>((set) => ({
|
|||
// Reconstruct user from refresh response
|
||||
const user: User = {
|
||||
id: response.user_id,
|
||||
email: '', // Will be populated if needed
|
||||
full_name: '',
|
||||
email: response.email,
|
||||
full_name: response.full_name,
|
||||
role: response.role as UserRole,
|
||||
is_active: true,
|
||||
created_at: '',
|
||||
|
|
|
|||
|
|
@ -98,6 +98,8 @@ export interface RefreshResponse {
|
|||
token_type: string;
|
||||
user_id: string;
|
||||
role: string;
|
||||
email: string;
|
||||
full_name: string;
|
||||
}
|
||||
|
||||
export interface JobCreateRequest {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue