You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.3 KiB
53 lines
1.3 KiB
import {Injectable} from '@angular/core';
|
|
import {JSONRequest} from '../../interface/JSONRequest';
|
|
import {HttpClient} from '@angular/common/http';
|
|
import {Observable} from 'rxjs';
|
|
import {ForumNoticeResponse} from '../../interface/Response';
|
|
import {HttpInterface} from '../../interface/HttpInterface';
|
|
import {catchError} from 'rxjs/operators';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
/**
|
|
* 公告服务
|
|
*/
|
|
export class NoticeService extends JSONRequest {
|
|
|
|
constructor(
|
|
private http: HttpClient
|
|
) {
|
|
super();
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取公告信息
|
|
*/
|
|
getAllNotices(): Observable<ForumNoticeResponse> {
|
|
return this.http.get<ForumNoticeResponse>(HttpInterface.getAllNotices, this.httpOptions)
|
|
.pipe(
|
|
catchError(this.handleError<any>('获取公告信息'))
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 添加公告
|
|
*/
|
|
addNotice(body): Observable<ForumNoticeResponse> {
|
|
return this.http.post<ForumNoticeResponse>(HttpInterface.addNotice, body, this.httpOptions)
|
|
.pipe(
|
|
catchError(this.handleError<any>('添加公告'))
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 删除公告
|
|
*/
|
|
deleteNotice(body): Observable<ForumNoticeResponse> {
|
|
return this.http.post<ForumNoticeResponse>(HttpInterface.deleteNotice, body, this.httpOptions)
|
|
.pipe(
|
|
catchError(this.handleError<any>('添加公告'))
|
|
);
|
|
}
|
|
}
|
|
|