Skip to content

Commit

Permalink
Add type for Task variables
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpassos committed Dec 4, 2018
1 parent b21da4f commit 52c59b6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/app/pages/home/home.page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router';
import { ItemService } from '../../services/item.service';
import { ItemService, Task } from '../../services/item.service';

@Component({
selector: 'app-page-home',
Expand All @@ -10,7 +10,7 @@ import { ItemService } from '../../services/item.service';

export class HomePage implements OnInit {

items: Array<any>;
items: Array<Task>;
loading = true;
errors: any;

Expand Down
6 changes: 3 additions & 3 deletions src/app/pages/update-item/update-item.page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { Validators, FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { ItemService } from '../../services/item.service';
import { ItemService, Task } from '../../services/item.service';

@Component({
selector: 'update-item',
Expand All @@ -10,7 +10,7 @@ import { ItemService } from '../../services/item.service';
})
export class UpdateItemPage implements OnInit {

item: any;
item: Task;
edit_item_form: FormGroup;

constructor(
Expand All @@ -23,7 +23,7 @@ export class UpdateItemPage implements OnInit {
ngOnInit() {
this.route.params.subscribe(
param => {
this.item = param;
this.item = param as Task;
this.edit_item_form = this.formBuilder.group({
title: new FormControl(this.item.title, Validators.required),
description: new FormControl(this.item.description, Validators.required),
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/item.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Injectable } from '@angular/core';
import { GET_TASKS, UPDATE_TASK, DELETE_TASK, ADD_TASK } from './graphql.queries';
import { Apollo } from 'apollo-angular';


interface Task {
export interface Task {
id: string;
version: number;
title: string;
description: string;
}
Expand Down

0 comments on commit 52c59b6

Please sign in to comment.