feat: adds primeng and novaloop design
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {catchError, map, Observable, throwError} from "rxjs";
|
||||
import {catchError, map, Observable, tap, throwError} from "rxjs";
|
||||
import {RegisterAppResponse} from "../interfaces/responses/register_app_response";
|
||||
import {GetAccessTokenResponse} from "../interfaces/responses/get_access_token_response";
|
||||
import {VerifyCredentialsResponse} from "../interfaces/responses/verify_credentials_response";
|
||||
import {MastodonApiService} from "./mastodon-api.service";
|
||||
import {RegisteredApp} from "../interfaces/public/registered_app";
|
||||
import {Account} from "../interfaces/public/account";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -57,11 +58,13 @@ export class MastodonApiAuthenticationService {
|
||||
window.location.href = `https://${instance}/oauth/authorize?${parameters}`;
|
||||
}
|
||||
|
||||
verifyCredentials(instance: string, accessToken: string): Observable<string> {
|
||||
verifyCredentials(instance: string, accessToken: string): Observable<Account> {
|
||||
const url = `https://${instance}/api/v1/accounts/verify_credentials`;
|
||||
return this.mastodonApiService
|
||||
.getAuthenticated<VerifyCredentialsResponse>(url, accessToken)
|
||||
.pipe(map((response) => response.id));
|
||||
.pipe(
|
||||
map((response) => response as Account)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user