mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-04-11 18:28:15 +00:00
feat: wire real auth — login returns user profile with role from platform, remove mock users and role selector tabs
This commit is contained in:
@@ -21,7 +21,19 @@ const clearTokens = () => {
|
||||
};
|
||||
|
||||
export const apiClient = {
|
||||
async login(email: string, password: string): Promise<{ accessToken: string; refreshToken: string }> {
|
||||
async login(email: string, password: string): Promise<{
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
user?: {
|
||||
id?: string;
|
||||
email?: string;
|
||||
firstName?: string;
|
||||
lastName?: string;
|
||||
avatarUrl?: string;
|
||||
role?: string;
|
||||
platformRoles?: string[];
|
||||
};
|
||||
}> {
|
||||
const response = await fetch(`${API_URL}/auth/login`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
@@ -33,9 +45,9 @@ export const apiClient = {
|
||||
throw new Error(data.message ?? 'Login failed');
|
||||
}
|
||||
|
||||
const tokens = await response.json();
|
||||
storeTokens(tokens.accessToken, tokens.refreshToken);
|
||||
return tokens;
|
||||
const data = await response.json();
|
||||
storeTokens(data.accessToken, data.refreshToken);
|
||||
return data;
|
||||
},
|
||||
|
||||
async graphql<T>(query: string, variables?: Record<string, unknown>): Promise<T> {
|
||||
|
||||
Reference in New Issue
Block a user