This commit is contained in:
Bastian Wagner
2026-06-24 10:09:12 +02:00
parent 35613eddb6
commit fc61ef5ba9
15 changed files with 581 additions and 19 deletions

View File

@@ -4,6 +4,8 @@ import { Observable, finalize, shareReplay, tap, throwError } from 'rxjs';
import {
AuthTokenResponse,
LoginRequest,
McpApiKeyResponse,
McpApiKeyStatus,
PublicUser,
PublicUserSearchResult,
RegisterRequest,
@@ -42,16 +44,13 @@ export class AuthService {
}
resendVerificationEmail(email: string): Observable<ResendVerificationResponse> {
return this.http.post<ResendVerificationResponse>(
`${this.apiUrl}/resend-verification`,
{ email },
);
return this.http.post<ResendVerificationResponse>(`${this.apiUrl}/resend-verification`, {
email,
});
}
loadCurrentUser(): Observable<PublicUser> {
return this.http
.get<PublicUser>(`${this.apiUrl}/me`)
.pipe(tap((user) => this.storeUser(user)));
return this.http.get<PublicUser>(`${this.apiUrl}/me`).pipe(tap((user) => this.storeUser(user)));
}
searchUsers(query: string): Observable<PublicUserSearchResult[]> {
@@ -67,6 +66,18 @@ export class AuthService {
.pipe(tap((user) => this.storeUser(user)));
}
getMcpApiKeyStatus(): Observable<McpApiKeyStatus> {
return this.http.get<McpApiKeyStatus>(`${this.apiUrl}/me/mcp-api-key`);
}
createMcpApiKey(): Observable<McpApiKeyResponse> {
return this.http.post<McpApiKeyResponse>(`${this.apiUrl}/me/mcp-api-key`, {});
}
revokeMcpApiKey(): Observable<McpApiKeyStatus> {
return this.http.delete<McpApiKeyStatus>(`${this.apiUrl}/me/mcp-api-key`);
}
accessToken(): string | null {
return this.storage?.getItem(ACCESS_TOKEN_KEY) ?? null;
}