import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';

import { ApiService } from './api.service';
import { QCM } from 'src/app/core/models';

@Injectable({ providedIn: 'root' })
export class QCMService {

    constructor(
        private apiService: ApiService
    ) { }

    get(type: string): Observable<QCM> {
        return this.apiService.get(`/qcm/${type}`)
            .pipe(map(data => data.qcm));
    }
}
