Commit e888e10e authored by Muhammad Saroosh Asif's avatar Muhammad Saroosh Asif
Browse files

Services

parent 0dfbd9af
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-appointments',
templateUrl: './appointments.component.html',
styleUrls: ['./appointments.component.css']
})
export class AppointmentsComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class AppointmentsService {
constructor() { }
}
import { CreateEvent } from './../event';
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class EventService {
constructor(private http: HttpClient) { }
getEvent(){
return this.http.get("/api/event");
}
getEventById(id: string) {
return this.http.get("/api/event/" + id);
}
createEvent(event: CreateEvent) {
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
})
};
return this.http.post<Event>("/api/event", event, httpOptions)
}
}
import { CreateNews, News } from '../news';
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class NewsService {
constructor(private http: HttpClient) { }
getNews(){
return this.http.get("/api/news");
}
getNewsById(id: string){
return this.http.get("/api/news/" + id);
}
createNews(news: CreateNews) {
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
})
};
return this.http.post<News>("/api/news", news, httpOptions)
}
}
export interface News {
_id: string
title: string
description: string
link: string
created_at: Date
updated_at: Date
}
export interface CreateNews {
title: string
description: string
link: string
}
\ No newline at end of file
import { CreateNews, News } from './../news';
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class NewsService {
constructor(private http: HttpClient) { }
getNews(){
return this.http.get("/api/news");
}
getNewsById(id: string){
return this.http.get("/api/news/" + id);
}
createNews(news: CreateNews) {
const httpOptions = {
headers: new HttpHeaders({
'Content-Type': 'application/json',
})
};
return this.http.post<News>("/api/news", news, httpOptions)
}
}
export interface Room {
id: string;
name: string;
description: string;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment