generated from nhcarrigan/template
feat: ability to edit suggestions when accepting
This commit is contained in:
@@ -75,10 +75,18 @@ export class ApiService {
|
||||
|
||||
delete<T>(endpoint: string): Observable<T> {
|
||||
return this.ensureCsrfToken().pipe(
|
||||
switchMap(() => this.http.delete<T>(`${this.apiUrl}${endpoint}`, {
|
||||
headers: this.getHeaders(),
|
||||
withCredentials: true
|
||||
}))
|
||||
switchMap(() => {
|
||||
// Don't send Content-Type for DELETE requests as they have no body
|
||||
const headers: Record<string, string> = {};
|
||||
const token = this.csrfToken();
|
||||
if (token) {
|
||||
headers['X-CSRF-Token'] = token;
|
||||
}
|
||||
return this.http.delete<T>(`${this.apiUrl}${endpoint}`, {
|
||||
headers: new HttpHeaders(headers),
|
||||
withCredentials: true
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user