diff --git a/src/components/tutorial.component.tsx b/src/components/tutorial.component.tsx index 5cf17a9..656218a 100644 --- a/src/components/tutorial.component.tsx +++ b/src/components/tutorial.component.tsx @@ -85,7 +85,7 @@ export default class Tutorial extends Component { published: status, }; - TutorialDataService.update(data, this.state.currentTutorial.id) + TutorialDataService.update(this.state.currentTutorial.id!, data) .then((response: any) => { this.setState((prevState) => ({ currentTutorial: { @@ -103,8 +103,8 @@ export default class Tutorial extends Component { updateTutorial() { TutorialDataService.update( - this.state.currentTutorial, - this.state.currentTutorial.id + this.state.currentTutorial.id!, + this.state.currentTutorial ) .then((response: any) => { console.log(response.data); @@ -118,7 +118,7 @@ export default class Tutorial extends Component { } deleteTutorial() { - TutorialDataService.delete(this.state.currentTutorial.id) + TutorialDataService.delete(this.state.currentTutorial.id!) .then((response: any) => { console.log(response.data); this.props.history.push("/tutorials"); diff --git a/src/services/tutorial.service.ts b/src/services/tutorial.service.ts index ea3b141..2c8f893 100644 --- a/src/services/tutorial.service.ts +++ b/src/services/tutorial.service.ts @@ -14,11 +14,11 @@ class TutorialDataService { return http.post("/tutorials", data); } - update(data: ITutorialData, id: any) { - return http.put(`/tutorials/${id}`, data); + update(id: string, data: ITutorialData) { + return http.put(`/tutorials/${id}`, data); } - delete(id: any) { + delete(id: string) { return http.delete(`/tutorials/${id}`); }