Add contacts, reply/forward, pagination, HTML toggle, Docker Compose for VPS
Co-authored-by: Junie <junie@jetbrains.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable, map } from 'rxjs';
|
||||
import { Message, Folder, Attachment, SendRequest, BlacklistEntry, PageResponse } from '../models/mail.models';
|
||||
import { Message, Folder, Attachment, SendRequest, BlacklistEntry, PageResponse, Contact } from '../models/mail.models';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -16,10 +16,10 @@ export class MailService {
|
||||
}
|
||||
|
||||
// Письма
|
||||
getMessages(folderId: number, page: number = 0, size: number = 20): Observable<Message[]> {
|
||||
getMessages(folderId: number, page: number = 0, size: number = 20): Observable<PageResponse<Message>> {
|
||||
return this.http.get<PageResponse<Message>>(`${this.apiUrl}/messages`, {
|
||||
params: { folderId, page, size }
|
||||
}).pipe(map(response => response.content));
|
||||
});
|
||||
}
|
||||
|
||||
getMessage(id: number): Observable<Message> {
|
||||
@@ -93,4 +93,21 @@ export class MailService {
|
||||
params: { senderEmail }
|
||||
});
|
||||
}
|
||||
|
||||
// Контакты
|
||||
getContacts(): Observable<Contact[]> {
|
||||
return this.http.get<Contact[]>(`${this.apiUrl}/contacts`);
|
||||
}
|
||||
|
||||
addContact(contact: Contact): Observable<Contact> {
|
||||
return this.http.post<Contact>(`${this.apiUrl}/contacts`, contact);
|
||||
}
|
||||
|
||||
updateContact(id: number, contact: Contact): Observable<Contact> {
|
||||
return this.http.put<Contact>(`${this.apiUrl}/contacts/${id}`, contact);
|
||||
}
|
||||
|
||||
deleteContact(id: number): Observable<void> {
|
||||
return this.http.delete<void>(`${this.apiUrl}/contacts/${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user