paperless-ngx/src-ui/src/app/services/trash.service.ts
shamoon fc1423057d Saving work on trash
[skip ci]
2024-06-15 14:06:58 -07:00

31 lines
828 B
TypeScript

import { HttpClient } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { Observable } from 'rxjs'
import { environment } from 'src/environments/environment'
import { ObjectWithId } from '../data/object-with-id'
@Injectable({
providedIn: 'root',
})
export class TrashService {
constructor(private http: HttpClient) {}
public getTrash(): Observable<ObjectWithId[]> {
return this.http.get<ObjectWithId[]>(`${environment.apiBaseUrl}trash/`)
}
public emptyTrash(documents: number[] = []) {
return this.http.post(`${environment.apiBaseUrl}trash/`, {
action: 'empty',
documents,
})
}
public restoreObjects(documents: number[]): Observable<any> {
return this.http.post(`${environment.apiBaseUrl}trash/`, {
action: 'restore',
documents,
})
}
}