Angular-RU/angular-ru-sdk

View on GitHub
libs/cdk/http/decorators/src/delete.decorator.ts

Summary

Maintainability
B
4 hrs
Test Coverage
import { DataHttpClient } from '@angular-ru/cdk/http';
import { EmitOptions, RequestType } from '@angular-ru/cdk/http/typings';
import { Descriptor } from '@angular-ru/cdk/typings';

import { ensureDescriptorByType } from './internal/ensure-descriptor-by-type';

export function Delete<T>(
    path: string = '/',
    emitOptions: EmitOptions = { emitFailure: true, emitSuccess: true }
): MethodDecorator {
    return (target: any & DataHttpClient, _name: string | symbol, descriptor: Descriptor): Descriptor =>
        ensureDescriptorByType<T>({ path, type: RequestType.DELETE, target, descriptor, emitOptions });
}