Permalink
Browse files

Step 9.6: Check access in PartiesForm

  • Loading branch information...
1 parent 2140730 commit a181ae69bfdea04c3d287838205df11d2bd3aba5 @kamilkisiela kamilkisiela committed with DAB0mB Sep 21, 2016
Showing with 6 additions and 0 deletions.
  1. +6 −0 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';
@@ -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);

0 comments on commit a181ae6

Please sign in to comment.