-
-
Save kibolho/d00eccbe0d47b0c151dfee012894cebe to your computer and use it in GitHub Desktop.
SOLID -Single Responsibility Principle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car { | |
constructor(name,model,year) { | |
this.name=name | |
this.model=model | |
this.year=year | |
} | |
getCar(id) { | |
return this.http.get('api/cars/'+id) | |
} | |
saveCar() { | |
return this.post('api/cars', { name: this.name, year: this.year, model: this.model }) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car { | |
constructor(name, model, year) { | |
this.name = name | |
this.model = model | |
this.year = year | |
} | |
} | |
class CarService { | |
getCar(id) { | |
return this.http.get('api/cars/'+id) | |
} | |
saveCar(car) { | |
this.http.post('api/cars', car) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment