Fix scouthub-home-be
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
import { keycloakAdminHttp } from './httpClient';
|
||||
import { KeycloakUserSummary } from './types';
|
||||
|
||||
export async function findUserByEmail(email: string): Promise<KeycloakUserSummary | null> {
|
||||
// TODO: GET {adminBaseUrl}/users?email={email}&exact=true, restituire il
|
||||
// primo risultato mappato a { id } oppure null se l'array è vuoto.
|
||||
throw new Error('Not implemented');
|
||||
}
|
||||
|
||||
export async function createUser(email: string, datiProfilo: object): Promise<{ userId: string }> {
|
||||
// TODO: POST {adminBaseUrl}/users con { email, ...datiProfilo, enabled: true },
|
||||
// leggere l'id dall'header Location della risposta.
|
||||
throw new Error('Not implemented');
|
||||
const response = await keycloakAdminHttp.get<Array<{ id: string }>>('/users', {
|
||||
params: { email, exact: true },
|
||||
});
|
||||
const [utente] = response.data;
|
||||
return utente ? { id: utente.id } : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user