Skip to content

Commit

Permalink
Step 9.6: Check access in PartiesForm
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkisiela authored and dotansimha committed Nov 27, 2016
1 parent ab44e78 commit bde51a5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions client/imports/app/parties/parties-form.component.ts
@@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { Meteor } from 'meteor/meteor';

import { Parties } from '../../../../both/collections/parties.collection';

Expand All @@ -25,6 +26,11 @@ export class PartiesFormComponent implements OnInit {
}

addParty(): void {
if (!Meteor.userId()) {
alert('Please log in to add a party');
return;
}

if (this.addForm.valid) {
Parties.insert(this.addForm.value);

Expand Down

0 comments on commit bde51a5

Please sign in to comment.