Nicholas Maidanos 6 gadus atpakaļ
vecāks
revīzija
8a38312abc

+ 1
- 1
.sourcemaps/main.js.map
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 17
- 1
src/app/app.component.ts Parādīt failu

@@ -8,6 +8,8 @@ import { ListPage } from '../pages/list/list';
8 8
 import { ChannelPage } from '../pages/channel/channel';
9 9
 import { CreateChannelPage } from '../pages/create-channel/create-channel';
10 10
 import { AllChannelsPage } from '../pages/all-channels/all-channels';
11
+import { ChannelProvider } from '../providers/channel/channel';
12
+import { MessageProvider } from '../providers/message/message';
11 13
 
12 14
 
13 15
 @Component({
@@ -20,7 +22,13 @@ export class MyApp {
20 22
 
21 23
   pages: Array<{title: string, component: any}>;
22 24
 
23
-  constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen) {
25
+  constructor(
26
+    public platform: Platform,
27
+    public statusBar: StatusBar,
28
+    public splashScreen: SplashScreen,
29
+    public channelProvider: ChannelProvider,
30
+    public messageProvider: MessageProvider
31
+  ) {
24 32
     this.initializeApp();
25 33
 
26 34
     // used for an example of ngFor and navigation
@@ -39,6 +47,14 @@ export class MyApp {
39 47
       this.statusBar.styleDefault();
40 48
       this.splashScreen.hide();
41 49
     });
50
+    this.channelProvider.userChannels;
51
+  }
52
+
53
+  setChannel(channel){
54
+    this.channelProvider.channel = channel;
55
+    console.log(this.channelProvider.channel);
56
+    this.messageProvider.get( result => {
57
+    })
42 58
   }
43 59
 
44 60
   openPage(page) {

+ 5
- 3
src/app/app.html Parādīt failu

@@ -22,7 +22,9 @@
22 22
         </ion-list-header>
23 23
 
24 24
         <!-- <ion-item (click)="openPage(ChannelPage)">General Channel</ion-item> -->
25
-        <ion-item menuClose (click)="openChannelPage()">General Channel</ion-item>
25
+        <ion-item menuClose *ngFor="let channel of this.channelProvider.userChannels" (click)="setChannel(channel)">
26
+          {{ channel.name }}
27
+        </ion-item>
26 28
 
27 29
         <button menuClose ion-button color="light" type="button"(click)="openCreateChannelPage()" round>+ New Channel</button>
28 30
         
@@ -33,7 +35,7 @@
33 35
           View All Channels
34 36
         </button>
35 37
 
36
-
38
+<!-- 
37 39
         <ion-list-header>
38 40
             Direct messages
39 41
           </ion-list-header>
@@ -42,7 +44,7 @@
42 44
           <ion-item (click)="openPage(ChannelPage)">Small_Wrld</ion-item>
43 45
 
44 46
           <button ion-button color="light" type="button" (click)="openPage(Channel)">+ New Direct Message</button>
45
-          
47
+           -->
46 48
 
47 49
 
48 50
 

+ 4
- 0
src/pages/all-channels/all-channels.html Parādīt failu

@@ -12,4 +12,8 @@
12 12
 
13 13
 <ion-content padding>
14 14
 
15
+  <ion-item menuClose *ngFor="let channel of this.channelProvider.allChannels" (click)="joinChannel(channel)">
16
+    {{ channel.name }}
17
+  </ion-item>
18
+
15 19
 </ion-content>

+ 12
- 1
src/pages/all-channels/all-channels.ts Parādīt failu

@@ -1,5 +1,6 @@
1 1
 import { Component } from '@angular/core';
2 2
 import { IonicPage, NavController, NavParams } from 'ionic-angular';
3
+import { ChannelProvider } from '../../providers/channel/channel';
3 4
 
4 5
 /**
5 6
  * Generated class for the AllChannelsPage page.
@@ -15,11 +16,21 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
15 16
 })
16 17
 export class AllChannelsPage {
17 18
 
18
-  constructor(public navCtrl: NavController, public navParams: NavParams) {
19
+  constructor(
20
+    public navCtrl: NavController,
21
+    public navParams: NavParams,
22
+    public channelProvider: ChannelProvider
23
+  ) {
19 24
   }
20 25
 
21 26
   ionViewDidLoad() {
22 27
     console.log('ionViewDidLoad AllChannelsPage');
23 28
   }
24 29
 
30
+  joinChannel(channel){
31
+    this.channelProvider.join(channel, result => {
32
+        this.navCtrl.remove(1);
33
+    });
34
+  }
35
+
25 36
 }

+ 1
- 1
src/pages/channel/channel.html Parādīt failu

@@ -61,7 +61,7 @@
61 61
       </ion-list> -->
62 62
 
63 63
     <ion-list padding>
64
-      <ion-item-sliding *ngFor="let message of messages">
64
+      <ion-item-sliding *ngFor="let message of this.messageProvider.messages">
65 65
           <ion-item>{{message.user.username}} - {{message.message}}</ion-item>
66 66
     
67 67
         <ion-item-options side="right">

+ 18
- 14
src/pages/channel/channel.ts Parādīt failu

@@ -19,7 +19,6 @@ export class ChannelPage {
19 19
 
20 20
 
21 21
   public messages=[];
22
-  public channels=[];
23 22
 
24 23
   public message: any;
25 24
 
@@ -41,13 +40,16 @@ export class ChannelPage {
41 40
     private messageProvider: MessageProvider,
42 41
     private channelProvider: ChannelProvider
43 42
   ) {
44
-      this.getMessages();
45
-      this.getChannels();
43
+      //this.getMessages();
44
+      this.messageProvider.get(result =>{
45
+
46
+      });
47
+      //this.getChannels();
46 48
   }
47 49
 
48 50
   ionViewDidLoad() {
49 51
     console.log('ionViewDidLoad ChannelPage');
50
-    this.start();
52
+    //this.start();
51 53
   }
52 54
 
53 55
 
@@ -56,25 +58,27 @@ export class ChannelPage {
56 58
   }
57 59
 
58 60
   getMessages(){
59
-    this.messageProvider.get(1, after => {
60
-      this.messages = after.json();
61
+    this.messageProvider.get(result =>{
62
+      
61 63
     });
62 64
   }
63 65
 
64
-  getChannels(){
65
-    this.timerToken = setInterval(this.channelProvider.get(channels => {
66
-      this.channels = channels;
67
-    }), 5000);
68
-  }
66
+  // getChannels(){
67
+  //   this.timerToken = setInterval(this.channelProvider.getuser(channels => {
68
+  //     this.channels = channels;
69
+  //   }), 5000);
70
+  // }
69 71
   
70 72
   runningLoopOfMessages(channelProvider: ChannelProvider) {
71
-    this.messageProvider.get(1, after => {
73
+    this.messageProvider.get( after => {
72 74
       this.messages = after.json();
73 75
     });
74 76
   }
75 77
   deleteMessage(messageId: number){
76 78
     this.messageProvider.delete(messageId, after =>{
77
-      this.getMessages();
79
+      this.messageProvider.get(callback => {
80
+        console.log(callback);
81
+      })
78 82
     });
79 83
   }
80 84
 
@@ -113,7 +117,7 @@ export class ChannelPage {
113 117
 
114 118
   sendMessage(){
115 119
     if (!this.message.trim()) return;
116
-    this.messageProvider.post(1, this.message, after => {
120
+    this.messageProvider.post(this.channelProvider.channel.id, this.message, after => {
117 121
       this.message = '';
118 122
       this.getMessages();
119 123
     });

+ 2
- 2
src/pages/create-channel/create-channel.html Parādīt failu

@@ -25,8 +25,8 @@
25 25
         <ion-input
26 26
         type="text"
27 27
         placeholder="# e.g. ZipTeam Study Session"
28
-        [(ngModel)]="message"
29
-        (keyup.enter)="sendMessage()"
28
+        [(ngModel)]="channel"
29
+        (keyup.enter)="createChannel()"
30 30
         >
31 31
         </ion-input>
32 32
         

+ 17
- 1
src/pages/create-channel/create-channel.ts Parādīt failu

@@ -1,5 +1,6 @@
1 1
 import { Component } from '@angular/core';
2 2
 import { IonicPage, NavController, NavParams } from 'ionic-angular';
3
+import { ChannelProvider } from '../../providers/channel/channel';
3 4
 
4 5
 /**
5 6
  * Generated class for the CreateChannelPage page.
@@ -15,11 +16,26 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
15 16
 })
16 17
 export class CreateChannelPage {
17 18
 
18
-  constructor(public navCtrl: NavController, public navParams: NavParams) {
19
+  private channel: string;
20
+
21
+  constructor(
22
+    public navCtrl: NavController, 
23
+    public navParams: NavParams,
24
+    public channelProvider: ChannelProvider
25
+  ) {
19 26
   }
20 27
 
21 28
   ionViewDidLoad() {
22 29
     console.log('ionViewDidLoad CreateChannelPage');
23 30
   }
24 31
 
32
+  createChannel(){
33
+    console.log(this.channel)
34
+    if(this.channel.trim()){
35
+      this.channelProvider.create(this.channel, result => {
36
+        this.navCtrl.remove(1);
37
+      });
38
+    }
39
+  }
40
+
25 41
 }

+ 1
- 1
src/pages/home/home.html Parādīt failu

@@ -70,6 +70,6 @@
70 70
 
71 71
   <!-- Toggle menu button -->
72 72
   <!-- <br> -->
73
-  <button ion-button secondary menuToggle>Toggle Menu</button> 
73
+  <!-- <button ion-button secondary menuToggle>Toggle Menu</button>  -->
74 74
   
75 75
 </ion-content>

+ 8
- 3
src/pages/home/home.ts Parādīt failu

@@ -5,6 +5,7 @@ import { FormGroup, FormBuilder, Validators, AbstractControl } from '@angular/fo
5 5
 import { UserProvider } from '../../providers/user/user';
6 6
 import { MessageProvider } from '../../providers/message/message';
7 7
 import { RegisterPage } from '../register/register';
8
+import { ChannelProvider } from '../../providers/channel/channel';
8 9
 
9 10
 
10 11
 
@@ -21,7 +22,12 @@ export class HomePage {
21 22
   username: AbstractControl;
22 23
   password: AbstractControl;
23 24
 
24
-  constructor(public navCtrl: NavController, private formbuilder: FormBuilder, private userprovider: UserProvider) {
25
+  constructor(
26
+    public navCtrl: NavController,
27
+    private formbuilder: FormBuilder,
28
+    private userprovider: UserProvider,
29
+    private channeProvder: ChannelProvider
30
+  ) {
25 31
 
26 32
     this.formgroup = this.formbuilder.group(
27 33
 
@@ -46,9 +52,8 @@ export class HomePage {
46 52
         console.log("Success!");
47 53
         this.userprovider.setToken(result.headers.get("authorization"));
48 54
         console.log(this.userprovider.getToken());
55
+        this.channeProvder.fetch();
49 56
         this.navCtrl.setRoot(ChannelPage);
50
-
51
-
52 57
       } else {
53 58
         console.log("invalid login attempt");
54 59
       }

+ 97
- 6
src/providers/channel/channel.ts Parādīt failu

@@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http';
2 2
 import { Injectable } from '@angular/core';
3 3
 import { UserProvider } from '../user/user';
4 4
 import { Http, RequestOptions, Headers } from '../../../node_modules/@angular/http';
5
+import { UrlProvider } from '../url/url';
5 6
 
6 7
 /*
7 8
   Generated class for the ChannelProvider provider.
@@ -12,19 +13,42 @@ import { Http, RequestOptions, Headers } from '../../../node_modules/@angular/ht
12 13
 @Injectable()
13 14
 export class ChannelProvider {
14 15
 
16
+
17
+  public channel = { "id": 1 };
18
+
19
+  public userChannels = [];
20
+  public allChannels = [];
15 21
   
16 22
 
17 23
   constructor(
18 24
     public http: Http,
19
-    public userProvider: UserProvider
25
+    public userProvider: UserProvider,
26
+    public urlProvider: UrlProvider
20 27
   ) {
21
-    console.log('Hello ChannelProvider Provider');
28
+    //console.log('Hello ChannelProvider Provider');
29
+  }
30
+
31
+  /////////////////////////////////////
32
+  getUserChannels(){
33
+    return this.userChannels;
34
+  }
35
+
36
+  setUserChannels(userChannels){
37
+    this.userChannels = userChannels;
22 38
   }
23 39
 
24
-  private baseUrl = "https://zipteampurple.herokuapp.com";
40
+  getAllChannels() {
41
+    return this.allChannels;
42
+  }
43
+  
44
+  setAllChannels(allChannels){
45
+    this.allChannels = allChannels;
46
+  }
47
+  ///////////////////////////////////
25 48
 
26
-  get(callback){
27
-    var url: string = this.baseUrl + "/user_channels";
49
+
50
+  create(name: string, callback) {
51
+    var url: string = this.urlProvider.getBaseUrl() + "/post_channel";
28 52
     var header = new Headers({
29 53
       'Authorization': this.userProvider.getToken(),
30 54
       'Content-Type': 'application/json'
@@ -32,10 +56,77 @@ export class ChannelProvider {
32 56
     });
33 57
     let options = new RequestOptions({headers: header});
34 58
  
59
+    var body = {
60
+      "purpose": "test",
61
+      "private": true,
62
+      "name": name,
63
+    };
64
+ 
65
+    this.http.post(url, body, options).subscribe( result => {
66
+      console.log(result);
67
+      this.fetch();
68
+      callback(result);
69
+    });
70
+
71
+  }
72
+
73
+  fetch(){
74
+    this.fetchUserChannels(userChannels => {
75
+      this.userChannels = userChannels;
76
+      this.fetchAllChannels( allChannels => {
77
+        this.allChannels = allChannels;
78
+        console.log(allChannels);
79
+        console.log(userChannels);
80
+      });
81
+    });
82
+  }
83
+
84
+  fetchUserChannels(callback){
85
+    var url: string = this.urlProvider.getBaseUrl() + "/user_channels";
86
+    var header = new Headers({
87
+      'Authorization': this.userProvider.getToken(),
88
+      'Content-Type': 'application/json'
89
+    });
90
+    let options = new RequestOptions({headers: header});
91
+    this.http.get(url,options).subscribe(result =>{
92
+      //console.log(result);
93
+      callback(result.json());
94
+    });
95
+  }
96
+
97
+  fetchAllChannels(callback){
98
+    var url: string = this.urlProvider.getBaseUrl() + "/get_channels";
99
+    var header = new Headers({
100
+      'Authorization': this.userProvider.getToken(),
101
+      'Content-Type': 'application/json'
102
+    });
103
+    let options = new RequestOptions({headers: header});
35 104
     this.http.get(url,options).subscribe(result =>{
36 105
       //console.log(result);
37 106
       callback(result.json());
38
-    })
107
+    });
108
+  }
109
+
110
+  join(channel, callback){
111
+
112
+    var url: string = this.urlProvider.getBaseUrl() + "/add_user";
113
+    var header = new Headers({
114
+      'Authorization': this.userProvider.getToken(),
115
+      'Content-Type': 'application/json'
116
+      
117
+    });
118
+    let options = new RequestOptions({headers: header});
119
+ 
120
+    var body = {
121
+      "id": channel.id,
122
+    };
123
+ 
124
+    this.http.post(url, body, options).subscribe( result => {
125
+      console.log(result);
126
+      this.fetch();
127
+      callback(result);
128
+    });
129
+
39 130
   }
40 131
 
41 132
   // post(channelId: number, message: string, callback){

+ 12
- 5
src/providers/message/message.ts Parādīt failu

@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
3 3
 import { Http, RequestOptions, Headers, Response } from '@angular/http';
4 4
 import { UserProvider } from '../user/user';
5 5
 import { UrlProvider } from '../url/url';
6
+import { ChannelProvider } from '../channel/channel';
6 7
 
7 8
 /*
8 9
   Generated class for the MessageProvider provider.
@@ -13,10 +14,13 @@ import { UrlProvider } from '../url/url';
13 14
 @Injectable()
14 15
 export class MessageProvider {
15 16
 
17
+  public messages = [];
18
+
16 19
   constructor(
17 20
     public http: Http,
18 21
     public userProvider: UserProvider,
19
-    public urlProvider: UrlProvider
22
+    public urlProvider: UrlProvider,
23
+    public channelProvider: ChannelProvider
20 24
   ) {
21 25
     console.log('Hello MessageProvider Provider');
22 26
   }
@@ -29,7 +33,7 @@ export class MessageProvider {
29 33
     let options = new RequestOptions({headers: header})
30 34
     this.http.get(url, options).subscribe( (result : Response) => {
31 35
       console.log(result);
32
-    })
36
+    });
33 37
   }
34 38
  
35 39
   post(channelId: number, message: string, callback){
@@ -48,23 +52,26 @@ export class MessageProvider {
48 52
  
49 53
     this.http.post(url, body,options).subscribe( (result : Response) => {
50 54
       console.log(result);
51
-      this.get(channelId, after => {
55
+      this.get(after => {
52 56
         callback();
53 57
       })
54 58
     })
55 59
   }
56 60
  
57
-  get(channelId: number, callback){
58
-    var url: string = this.urlProvider.getBaseUrl() + "/messages?channelid=" + channelId ;
61
+  get(callback){
62
+    var url: string = this.urlProvider.getBaseUrl() + "/messages?channelId=" + this.channelProvider.channel.id ;
59 63
     var header = new Headers({
60 64
       'Authorization': this.userProvider.getToken(),
61 65
       'Content-Type': 'application/json'
62 66
       
63 67
     });
68
+
69
+    console.log(url);
64 70
     let options = new RequestOptions({headers: header});
65 71
  
66 72
     this.http.get(url,options).subscribe(result =>{
67 73
       console.log(result);
74
+      this.messages = result.json();
68 75
       callback(result);
69 76
     })
70 77
   }

+ 2
- 2
src/providers/url/url.ts Parādīt failu

@@ -14,8 +14,8 @@ export class UrlProvider {
14 14
   //   console.log('Hello UrlProvider Provider');
15 15
   // }
16 16
 
17
-  //private baseUrl = "http://localhost:8080";
18
-  private baseUrl = "https://zipteampurple.herokuapp.com";
17
+  private baseUrl = "http://localhost:8080";
18
+  //private baseUrl = "https://zipteampurple.herokuapp.com";
19 19
 
20 20
   setBaseUrl(baseUrl: string){
21 21
     this.baseUrl = baseUrl;

+ 2
- 2
www/build/0.js Parādīt failu

@@ -1,6 +1,6 @@
1 1
 webpackJsonp([0],{
2 2
 
3
-/***/ 287:
3
+/***/ 286:
4 4
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
5 5
 
6 6
 "use strict";
@@ -8,7 +8,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
8 8
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RegisterPageModule", function() { return RegisterPageModule; });
9 9
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
10 10
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__(20);
11
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__register__ = __webpack_require__(105);
11
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__register__ = __webpack_require__(107);
12 12
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
13 13
     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14 14
     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);

+ 1
- 1
www/build/1.js Parādīt failu

@@ -8,7 +8,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
8 8
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CreateChannelPageModule", function() { return CreateChannelPageModule; });
9 9
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
10 10
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__(20);
11
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__create_channel__ = __webpack_require__(104);
11
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__create_channel__ = __webpack_require__(106);
12 12
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
13 13
     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14 14
     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);

+ 2
- 2
www/build/2.js Parādīt failu

@@ -1,6 +1,6 @@
1 1
 webpackJsonp([2],{
2 2
 
3
-/***/ 286:
3
+/***/ 287:
4 4
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
5 5
 
6 6
 "use strict";
@@ -8,7 +8,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
8 8
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChannelPageModule", function() { return ChannelPageModule; });
9 9
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
10 10
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__(20);
11
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__channel__ = __webpack_require__(52);
11
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__channel__ = __webpack_require__(54);
12 12
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
13 13
     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14 14
     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);

+ 1
- 1
www/build/3.js Parādīt failu

@@ -8,7 +8,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
8 8
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AllChannelsPageModule", function() { return AllChannelsPageModule; });
9 9
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
10 10
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__(20);
11
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__all_channels__ = __webpack_require__(103);
11
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__all_channels__ = __webpack_require__(105);
12 12
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
13 13
     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
14 14
     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);

+ 373
- 241
www/build/main.js Parādīt failu

@@ -1,12 +1,13 @@
1 1
 webpackJsonp([4],{
2 2
 
3
-/***/ 103:
3
+/***/ 105:
4 4
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
5 5
 
6 6
 "use strict";
7 7
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AllChannelsPage; });
8 8
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
9 9
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__(20);
10
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__providers_channel_channel__ = __webpack_require__(30);
10 11
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
11 12
     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
12 13
     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -18,6 +19,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
18 19
 };
19 20
 
20 21
 
22
+
21 23
 /**
22 24
  * Generated class for the AllChannelsPage page.
23 25
  *
@@ -25,18 +27,27 @@ var __metadata = (this && this.__metadata) || function (k, v) {
25 27
  * Ionic pages and navigation.
26 28
  */
27 29
 var AllChannelsPage = /** @class */ (function () {
28
-    function AllChannelsPage(navCtrl, navParams) {
30
+    function AllChannelsPage(navCtrl, navParams, channelProvider) {
29 31
         this.navCtrl = navCtrl;
30 32
         this.navParams = navParams;
33
+        this.channelProvider = channelProvider;
31 34
     }
32 35
     AllChannelsPage.prototype.ionViewDidLoad = function () {
33 36
         console.log('ionViewDidLoad AllChannelsPage');
34 37
     };
38
+    AllChannelsPage.prototype.joinChannel = function (channel) {
39
+        var _this = this;
40
+        this.channelProvider.join(channel, function (result) {
41
+            _this.navCtrl.remove(1);
42
+        });
43
+    };
35 44
     AllChannelsPage = __decorate([
36 45
         Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({
37
-            selector: 'page-all-channels',template:/*ion-inline-start:"/Users/jaehoonp/ZipTeamPurple-FrontEnd/src/pages/all-channels/all-channels.html"*/'\n\n\n<ion-header>\n\n  <ion-navbar>\n    <ion-title>All Available Channels</ion-title>\n  </ion-navbar>\n\n</ion-header>\n\n\n<ion-content padding>\n\n</ion-content>\n'/*ion-inline-end:"/Users/jaehoonp/ZipTeamPurple-FrontEnd/src/pages/all-channels/all-channels.html"*/,
46
+            selector: 'page-all-channels',template:/*ion-inline-start:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/all-channels/all-channels.html"*/'\n\n\n<ion-header>\n\n  <ion-navbar>\n    <ion-title>All Available Channels</ion-title>\n  </ion-navbar>\n\n</ion-header>\n\n\n<ion-content padding>\n\n  <ion-item menuClose *ngFor="let channel of this.channelProvider.allChannels" (click)="joinChannel(channel)">\n    {{ channel.name }}\n  </ion-item>\n\n</ion-content>\n'/*ion-inline-end:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/all-channels/all-channels.html"*/,
38 47
         }),
39
-        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["g" /* NavController */], __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["h" /* NavParams */]])
48
+        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["g" /* NavController */],
49
+            __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["h" /* NavParams */],
50
+            __WEBPACK_IMPORTED_MODULE_2__providers_channel_channel__["a" /* ChannelProvider */]])
40 51
     ], AllChannelsPage);
41 52
     return AllChannelsPage;
42 53
 }());
@@ -45,13 +56,14 @@ var AllChannelsPage = /** @class */ (function () {
45 56
 
46 57
 /***/ }),
47 58
 
48
-/***/ 104:
59
+/***/ 106:
49 60
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
50 61
 
51 62
 "use strict";
52 63
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CreateChannelPage; });
53 64
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
54 65
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__(20);
66
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__providers_channel_channel__ = __webpack_require__(30);
55 67
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
56 68
     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
57 69
     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -63,6 +75,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
63 75
 };
64 76
 
65 77
 
78
+
66 79
 /**
67 80
  * Generated class for the CreateChannelPage page.
68 81
  *
@@ -70,18 +83,30 @@ var __metadata = (this && this.__metadata) || function (k, v) {
70 83
  * Ionic pages and navigation.
71 84
  */
72 85
 var CreateChannelPage = /** @class */ (function () {
73
-    function CreateChannelPage(navCtrl, navParams) {
86
+    function CreateChannelPage(navCtrl, navParams, channelProvider) {
74 87
         this.navCtrl = navCtrl;
75 88
         this.navParams = navParams;
89
+        this.channelProvider = channelProvider;
76 90
     }
77 91
     CreateChannelPage.prototype.ionViewDidLoad = function () {
78 92
         console.log('ionViewDidLoad CreateChannelPage');
79 93
     };
94
+    CreateChannelPage.prototype.createChannel = function () {
95
+        var _this = this;
96
+        console.log(this.channel);
97
+        if (this.channel.trim()) {
98
+            this.channelProvider.create(this.channel, function (result) {
99
+                _this.navCtrl.remove(1);
100
+            });
101
+        }
102
+    };
80 103
     CreateChannelPage = __decorate([
81 104
         Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({
82
-            selector: 'page-create-channel',template:/*ion-inline-start:"/Users/jaehoonp/ZipTeamPurple-FrontEnd/src/pages/create-channel/create-channel.html"*/'\n\n\n<ion-header>\n\n  <ion-navbar>\n    <ion-title>createChannel</ion-title>\n  </ion-navbar>\n\n</ion-header>\n\n\n<ion-content text-center>\n\n    <br><br><br><br>\n\n    <h1>Create a channel</h1>\n    <br>\n    <h3>Channels are where your members communicate.</h3>\n\n    <br><br><br>\n    <h2>Name</h2>\n    <ion-item >\n\n        <ion-input\n        type="text"\n        placeholder="# e.g. ZipTeam Study Session"\n        [(ngModel)]="message"\n        (keyup.enter)="sendMessage()"\n        >\n        </ion-input>\n        \n\n      </ion-item>\n\n\n</ion-content>\n'/*ion-inline-end:"/Users/jaehoonp/ZipTeamPurple-FrontEnd/src/pages/create-channel/create-channel.html"*/,
105
+            selector: 'page-create-channel',template:/*ion-inline-start:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/create-channel/create-channel.html"*/'\n\n\n<ion-header>\n\n  <ion-navbar>\n    <ion-title>createChannel</ion-title>\n  </ion-navbar>\n\n</ion-header>\n\n\n<ion-content text-center>\n\n    <br><br><br><br>\n\n    <h1>Create a channel</h1>\n    <br>\n    <h3>Channels are where your members communicate.</h3>\n\n    <br><br><br>\n    <h2>Name</h2>\n    <ion-item >\n\n        <ion-input\n        type="text"\n        placeholder="# e.g. ZipTeam Study Session"\n        [(ngModel)]="channel"\n        (keyup.enter)="createChannel()"\n        >\n        </ion-input>\n        \n\n      </ion-item>\n\n\n</ion-content>\n'/*ion-inline-end:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/create-channel/create-channel.html"*/,
83 106
         }),
84
-        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["g" /* NavController */], __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["h" /* NavParams */]])
107
+        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["g" /* NavController */],
108
+            __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["h" /* NavParams */],
109
+            __WEBPACK_IMPORTED_MODULE_2__providers_channel_channel__["a" /* ChannelProvider */]])
85 110
     ], CreateChannelPage);
86 111
     return CreateChannelPage;
87 112
 }());
@@ -90,7 +115,7 @@ var CreateChannelPage = /** @class */ (function () {
90 115
 
91 116
 /***/ }),
92 117
 
93
-/***/ 105:
118
+/***/ 107:
94 119
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
95 120
 
96 121
 "use strict";
@@ -124,7 +149,7 @@ var RegisterPage = /** @class */ (function () {
124 149
     };
125 150
     RegisterPage = __decorate([
126 151
         Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({
127
-            selector: 'page-register',template:/*ion-inline-start:"/Users/jaehoonp/ZipTeamPurple-FrontEnd/src/pages/register/register.html"*/'<ion-header>\n\n  <ion-navbar>\n    <ion-title>Register</ion-title>\n  </ion-navbar>\n\n</ion-header>\n\n\n<ion-content text-center class="register">\n\n    <br><br><br><br><br>\n\n  <ion-list>\n    <ion-item>\n      <ion-label fixed>Username</ion-label>\n      <ion-input type="text"></ion-input>\n    </ion-item>\n\n\n    <ion-item>\n      <ion-label fixed>First Name</ion-label>\n      <ion-input type="text"></ion-input>\n    </ion-item>\n\n\n    <ion-item>\n      <ion-label fixed>Last Name</ion-label>\n      <ion-input type="text"></ion-input>\n    </ion-item>\n\n\n    <ion-item>\n      <ion-label fixed>Password</ion-label>\n      <ion-input type="text"></ion-input>\n    </ion-item>\n\n\n    <ion-item>\n      <ion-label fixed>Email</ion-label>\n      <ion-input type="text"></ion-input>\n    </ion-item>\n  </ion-list>\n  <button ion-button color="danger" round (click)="register()">Confirm</button>\n  <br>\n  <button ion-button color="danger" round (click)="cancel()">Cancel</button>\n</ion-content>'/*ion-inline-end:"/Users/jaehoonp/ZipTeamPurple-FrontEnd/src/pages/register/register.html"*/,
152
+            selector: 'page-register',template:/*ion-inline-start:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/register/register.html"*/'<ion-header>\n\n  <ion-navbar>\n    <ion-title>Register</ion-title>\n  </ion-navbar>\n\n</ion-header>\n\n\n<ion-content text-center class="register">\n\n    <br><br><br><br><br>\n\n  <ion-list>\n    <ion-item>\n      <ion-label fixed>Username</ion-label>\n      <ion-input type="text"></ion-input>\n    </ion-item>\n\n\n    <ion-item>\n      <ion-label fixed>First Name</ion-label>\n      <ion-input type="text"></ion-input>\n    </ion-item>\n\n\n    <ion-item>\n      <ion-label fixed>Last Name</ion-label>\n      <ion-input type="text"></ion-input>\n    </ion-item>\n\n\n    <ion-item>\n      <ion-label fixed>Password</ion-label>\n      <ion-input type="text"></ion-input>\n    </ion-item>\n\n\n    <ion-item>\n      <ion-label fixed>Email</ion-label>\n      <ion-input type="text"></ion-input>\n    </ion-item>\n  </ion-list>\n  <button ion-button color="danger" round (click)="register()">Confirm</button>\n  <br>\n  <button ion-button color="danger" round (click)="cancel()">Cancel</button>\n</ion-content>'/*ion-inline-end:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/register/register.html"*/,
128 153
         }),
129 154
         __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["g" /* NavController */],
130 155
             __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["h" /* NavParams */]])
@@ -136,7 +161,7 @@ var RegisterPage = /** @class */ (function () {
136 161
 
137 162
 /***/ }),
138 163
 
139
-/***/ 117:
164
+/***/ 119:
140 165
 /***/ (function(module, exports) {
141 166
 
142 167
 function webpackEmptyAsyncContext(req) {
@@ -149,11 +174,11 @@ function webpackEmptyAsyncContext(req) {
149 174
 webpackEmptyAsyncContext.keys = function() { return []; };
150 175
 webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext;
151 176
 module.exports = webpackEmptyAsyncContext;
152
-webpackEmptyAsyncContext.id = 117;
177
+webpackEmptyAsyncContext.id = 119;
153 178
 
154 179
 /***/ }),
155 180
 
156
-/***/ 159:
181
+/***/ 161:
157 182
 /***/ (function(module, exports, __webpack_require__) {
158 183
 
159 184
 var map = {
@@ -162,7 +187,7 @@ var map = {
162 187
 		3
163 188
 	],
164 189
 	"../pages/channel/channel.module": [
165
-		286,
190
+		287,
166 191
 		2
167 192
 	],
168 193
 	"../pages/create-channel/create-channel.module": [
@@ -170,7 +195,7 @@ var map = {
170 195
 		1
171 196
 	],
172 197
 	"../pages/register/register.module": [
173
-		287,
198
+		286,
174 199
 		0
175 200
 	]
176 201
 };
@@ -185,169 +210,11 @@ function webpackAsyncContext(req) {
185 210
 webpackAsyncContext.keys = function webpackAsyncContextKeys() {
186 211
 	return Object.keys(map);
187 212
 };
188
-webpackAsyncContext.id = 159;
213
+webpackAsyncContext.id = 161;
189 214
 module.exports = webpackAsyncContext;
190 215
 
191 216
 /***/ }),
192 217
 
193
-/***/ 160:
194
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
195
-
196
-"use strict";
197
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MessageProvider; });
198
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
199
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_http__ = __webpack_require__(46);
200
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__user_user__ = __webpack_require__(47);
201
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__url_url__ = __webpack_require__(80);
202
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
203
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
204
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
205
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
206
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
207
-};
208
-var __metadata = (this && this.__metadata) || function (k, v) {
209
-    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
210
-};
211
-
212
-
213
-
214
-
215
-/*
216
-  Generated class for the MessageProvider provider.
217
-
218
-  See https://angular.io/guide/dependency-injection for more info on providers
219
-  and Angular DI.
220
-*/
221
-var MessageProvider = /** @class */ (function () {
222
-    function MessageProvider(http, userProvider, urlProvider) {
223
-        this.http = http;
224
-        this.userProvider = userProvider;
225
-        this.urlProvider = urlProvider;
226
-        console.log('Hello MessageProvider Provider');
227
-    }
228
-    MessageProvider.prototype.getAll = function () {
229
-        var url = this.urlProvider.getBaseUrl() + "/get_messages";
230
-        var header = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["a" /* Headers */]({
231
-            'Authorization': this.userProvider.getToken()
232
-        });
233
-        var options = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["d" /* RequestOptions */]({ headers: header });
234
-        this.http.get(url, options).subscribe(function (result) {
235
-            console.log(result);
236
-        });
237
-    };
238
-    MessageProvider.prototype.post = function (channelId, message, callback) {
239
-        var _this = this;
240
-        var url = this.urlProvider.getBaseUrl() + "/post";
241
-        var header = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["a" /* Headers */]({
242
-            'Authorization': this.userProvider.getToken(),
243
-            'Content-Type': 'application/json'
244
-        });
245
-        var options = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["d" /* RequestOptions */]({ headers: header });
246
-        var body = {
247
-            "channelId": channelId,
248
-            "message": message
249
-        };
250
-        this.http.post(url, body, options).subscribe(function (result) {
251
-            console.log(result);
252
-            _this.get(channelId, function (after) {
253
-                callback();
254
-            });
255
-        });
256
-    };
257
-    MessageProvider.prototype.get = function (channelId, callback) {
258
-        var url = this.urlProvider.getBaseUrl() + "/messages?channelid=" + channelId;
259
-        var header = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["a" /* Headers */]({
260
-            'Authorization': this.userProvider.getToken(),
261
-            'Content-Type': 'application/json'
262
-        });
263
-        var options = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["d" /* RequestOptions */]({ headers: header });
264
-        this.http.get(url, options).subscribe(function (result) {
265
-            console.log(result);
266
-            callback(result);
267
-        });
268
-    };
269
-    MessageProvider.prototype.delete = function (messageId, callback) {
270
-        var url = this.urlProvider.getBaseUrl() + "/delete?messageId=" + messageId;
271
-        var header = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["a" /* Headers */]({
272
-            'Authorization': this.userProvider.getToken(),
273
-            'Content-Type': 'application/json'
274
-        });
275
-        var options = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["d" /* RequestOptions */]({ headers: header });
276
-        this.http.delete(url, options).subscribe(function (result) {
277
-            console.log(result);
278
-            callback();
279
-        });
280
-    };
281
-    MessageProvider = __decorate([
282
-        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */])(),
283
-        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__angular_http__["b" /* Http */],
284
-            __WEBPACK_IMPORTED_MODULE_2__user_user__["a" /* UserProvider */],
285
-            __WEBPACK_IMPORTED_MODULE_3__url_url__["a" /* UrlProvider */]])
286
-    ], MessageProvider);
287
-    return MessageProvider;
288
-}());
289
-
290
-//# sourceMappingURL=message.js.map
291
-
292
-/***/ }),
293
-
294
-/***/ 161:
295
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
296
-
297
-"use strict";
298
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ChannelProvider; });
299
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
300
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__user_user__ = __webpack_require__(47);
301
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__ = __webpack_require__(46);
302
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
303
-    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
304
-    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
305
-    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
306
-    return c > 3 && r && Object.defineProperty(target, key, r), r;
307
-};
308
-var __metadata = (this && this.__metadata) || function (k, v) {
309
-    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
310
-};
311
-
312
-
313
-
314
-/*
315
-  Generated class for the ChannelProvider provider.
316
-
317
-  See https://angular.io/guide/dependency-injection for more info on providers
318
-  and Angular DI.
319
-*/
320
-var ChannelProvider = /** @class */ (function () {
321
-    function ChannelProvider(http, userProvider) {
322
-        this.http = http;
323
-        this.userProvider = userProvider;
324
-        this.baseUrl = "https://zipteampurple.herokuapp.com";
325
-        console.log('Hello ChannelProvider Provider');
326
-    }
327
-    ChannelProvider.prototype.get = function (callback) {
328
-        var url = this.baseUrl + "/user_channels";
329
-        var header = new __WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["a" /* Headers */]({
330
-            'Authorization': this.userProvider.getToken(),
331
-            'Content-Type': 'application/json'
332
-        });
333
-        var options = new __WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["d" /* RequestOptions */]({ headers: header });
334
-        this.http.get(url, options).subscribe(function (result) {
335
-            //console.log(result);
336
-            callback(result.json());
337
-        });
338
-    };
339
-    ChannelProvider = __decorate([
340
-        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */])(),
341
-        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["b" /* Http */],
342
-            __WEBPACK_IMPORTED_MODULE_1__user_user__["a" /* UserProvider */]])
343
-    ], ChannelProvider);
344
-    return ChannelProvider;
345
-}());
346
-
347
-//# sourceMappingURL=channel.js.map
348
-
349
-/***/ }),
350
-
351 218
 /***/ 205:
352 219
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
353 220
 
@@ -355,10 +222,11 @@ var ChannelProvider = /** @class */ (function () {
355 222
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HomePage; });
356 223
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
357 224
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__(20);
358
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__channel_channel__ = __webpack_require__(52);
225
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__channel_channel__ = __webpack_require__(54);
359 226
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_forms__ = __webpack_require__(15);
360 227
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__providers_user_user__ = __webpack_require__(47);
361
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__register_register__ = __webpack_require__(105);
228
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__register_register__ = __webpack_require__(107);
229
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__providers_channel_channel__ = __webpack_require__(30);
362 230
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
363 231
     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
364 232
     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -374,11 +242,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
374 242
 
375 243
 
376 244
 
245
+
377 246
 var HomePage = /** @class */ (function () {
378
-    function HomePage(navCtrl, formbuilder, userprovider) {
247
+    function HomePage(navCtrl, formbuilder, userprovider, channeProvder) {
379 248
         this.navCtrl = navCtrl;
380 249
         this.formbuilder = formbuilder;
381 250
         this.userprovider = userprovider;
251
+        this.channeProvder = channeProvder;
382 252
         this.formgroup = this.formbuilder.group({
383 253
             username: ['', __WEBPACK_IMPORTED_MODULE_3__angular_forms__["f" /* Validators */].required],
384 254
             password: ['', __WEBPACK_IMPORTED_MODULE_3__angular_forms__["f" /* Validators */].required]
@@ -396,6 +266,7 @@ var HomePage = /** @class */ (function () {
396 266
                 console.log("Success!");
397 267
                 _this.userprovider.setToken(result.headers.get("authorization"));
398 268
                 console.log(_this.userprovider.getToken());
269
+                _this.channeProvder.fetch();
399 270
                 _this.navCtrl.setRoot(__WEBPACK_IMPORTED_MODULE_2__channel_channel__["a" /* ChannelPage */]);
400 271
             }
401 272
             else {
@@ -410,9 +281,12 @@ var HomePage = /** @class */ (function () {
410 281
     };
411 282
     HomePage = __decorate([
412 283
         Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({
413
-            selector: 'page-home',template:/*ion-inline-start:"/Users/jaehoonp/ZipTeamPurple-FrontEnd/src/pages/home/home.html"*/'<ion-header>\n</ion-header>\n\n\n\n<ion-content text-center class = "login">\n\n  <br><br><br><br><br>\n  <img src="../assets/imgs/fullLogo.png" alt="SLACK" class="rounded-corners">\n\n  <br><br><br><br>\n  \n\n\n  <form [formGroup]="formgroup" (ngSubmit)="sendLogin(formgroup.value)">\n\n<ion-list>\n\n  <ion-item text-center>\n\n\n    <ion-label fixed>Username</ion-label>\n    <ion-input type="text" formControlName="username"></ion-input>\n  </ion-item>\n\n  <ion-item text-center *ngIf="username.hasError(\'required\') && username.touched">\n    <p> *Please enter your username</p>\n  </ion-item>\n\n  <ion-item text-center>\n    <ion-label fixed>Password</ion-label>\n    <ion-input type="password" formControlName="password"></ion-input>\n  </ion-item>\n\n  <ion-item text-center *ngIf="password.hasError(\'required\') && password.touched">\n      <p> *Please enter your password</p>\n    </ion-item>\n\n\n</ion-list>\n\n\n\n\n<button ion-button color="danger" round type="submit">Login</button>\n\n<!-- line break -->\n<br>\n\n<button ion-button color="danger" (click)="registerPage()" round>Sign Up</button>\n\n\n</form>\n\n\n  <form [formGroup]="loginform" (ngSubmit)="sendLogin(loginForm.value)" *ngIf="loginForm">\n\n    <ion-label fixed>Username</ion-label>\n    <input type="text" name="name" formControlName="username">\n\n    <ion-label fixed>Password</ion-label>\n    <input type="text" name="name" formControlName="password">\n\n    <input type="submit" class="cta-btn filled" value="Submit" [disabled]="!loginForm.valid">\n   </form>\n\n\n\n\n\n  <!-- Toggle menu button -->\n  <!-- <br> -->\n  <button ion-button secondary menuToggle>Toggle Menu</button> \n  \n</ion-content>\n'/*ion-inline-end:"/Users/jaehoonp/ZipTeamPurple-FrontEnd/src/pages/home/home.html"*/
284
+            selector: 'page-home',template:/*ion-inline-start:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/home/home.html"*/'<ion-header>\n</ion-header>\n\n\n\n<ion-content text-center class = "login">\n\n  <br><br><br><br><br>\n  <img src="../assets/imgs/fullLogo.png" alt="SLACK" class="rounded-corners">\n\n  <br><br><br><br>\n  \n\n\n  <form [formGroup]="formgroup" (ngSubmit)="sendLogin(formgroup.value)">\n\n<ion-list>\n\n  <ion-item text-center>\n\n\n    <ion-label fixed>Username</ion-label>\n    <ion-input type="text" formControlName="username"></ion-input>\n  </ion-item>\n\n  <ion-item text-center *ngIf="username.hasError(\'required\') && username.touched">\n    <p> *Please enter your username</p>\n  </ion-item>\n\n  <ion-item text-center>\n    <ion-label fixed>Password</ion-label>\n    <ion-input type="password" formControlName="password"></ion-input>\n  </ion-item>\n\n  <ion-item text-center *ngIf="password.hasError(\'required\') && password.touched">\n      <p> *Please enter your password</p>\n    </ion-item>\n\n\n</ion-list>\n\n\n\n\n<button ion-button color="danger" round type="submit">Login</button>\n\n<!-- line break -->\n<br>\n\n<button ion-button color="danger" (click)="registerPage()" round>Sign Up</button>\n\n\n</form>\n\n\n  <form [formGroup]="loginform" (ngSubmit)="sendLogin(loginForm.value)" *ngIf="loginForm">\n\n    <ion-label fixed>Username</ion-label>\n    <input type="text" name="name" formControlName="username">\n\n    <ion-label fixed>Password</ion-label>\n    <input type="text" name="name" formControlName="password">\n\n    <input type="submit" class="cta-btn filled" value="Submit" [disabled]="!loginForm.valid">\n   </form>\n\n\n\n\n\n  <!-- Toggle menu button -->\n  <!-- <br> -->\n  <!-- <button ion-button secondary menuToggle>Toggle Menu</button>  -->\n  \n</ion-content>\n'/*ion-inline-end:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/home/home.html"*/
414 285
         }),
415
-        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["g" /* NavController */], __WEBPACK_IMPORTED_MODULE_3__angular_forms__["a" /* FormBuilder */], __WEBPACK_IMPORTED_MODULE_4__providers_user_user__["a" /* UserProvider */]])
286
+        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["g" /* NavController */],
287
+            __WEBPACK_IMPORTED_MODULE_3__angular_forms__["a" /* FormBuilder */],
288
+            __WEBPACK_IMPORTED_MODULE_4__providers_user_user__["a" /* UserProvider */],
289
+            __WEBPACK_IMPORTED_MODULE_6__providers_channel_channel__["a" /* ChannelProvider */]])
416 290
     ], HomePage);
417 291
     return HomePage;
418 292
 }());
@@ -466,7 +340,7 @@ var ListPage = /** @class */ (function () {
466 340
     };
467 341
     ListPage = ListPage_1 = __decorate([
468 342
         Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({
469
-            selector: 'page-list',template:/*ion-inline-start:"/Users/jaehoonp/ZipTeamPurple-FrontEnd/src/pages/list/list.html"*/'<ion-header>\n  <ion-navbar>\n    <button ion-button menuToggle>\n      <ion-icon name="menu"></ion-icon>\n    </button>\n    <ion-title>List</ion-title>\n  </ion-navbar>\n</ion-header>\n\n<ion-content>\n  <ion-list>\n    <button ion-item *ngFor="let item of items" (click)="itemTapped($event, item)">\n      <ion-icon [name]="item.icon" item-start></ion-icon>\n      {{item.title}}\n      <div class="item-note" item-end>\n        {{item.note}}\n      </div>\n    </button>\n  </ion-list>\n  <div *ngIf="selectedItem" padding>\n    You navigated here from <b>{{selectedItem.title}}</b>\n  </div>\n</ion-content>\n'/*ion-inline-end:"/Users/jaehoonp/ZipTeamPurple-FrontEnd/src/pages/list/list.html"*/
343
+            selector: 'page-list',template:/*ion-inline-start:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/list/list.html"*/'<ion-header>\n  <ion-navbar>\n    <button ion-button menuToggle>\n      <ion-icon name="menu"></ion-icon>\n    </button>\n    <ion-title>List</ion-title>\n  </ion-navbar>\n</ion-header>\n\n<ion-content>\n  <ion-list>\n    <button ion-item *ngFor="let item of items" (click)="itemTapped($event, item)">\n      <ion-icon [name]="item.icon" item-start></ion-icon>\n      {{item.title}}\n      <div class="item-note" item-end>\n        {{item.note}}\n      </div>\n    </button>\n  </ion-list>\n  <div *ngIf="selectedItem" padding>\n    You navigated here from <b>{{selectedItem.title}}</b>\n  </div>\n</ion-content>\n'/*ion-inline-end:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/list/list.html"*/
470 344
         }),
471 345
         __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["g" /* NavController */], __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["h" /* NavParams */]])
472 346
     ], ListPage);
@@ -503,18 +377,18 @@ Object(__WEBPACK_IMPORTED_MODULE_0__angular_platform_browser_dynamic__["a" /* pl
503 377
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__app_component__ = __webpack_require__(270);
504 378
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__pages_home_home__ = __webpack_require__(205);
505 379
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__pages_list_list__ = __webpack_require__(206);
506
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pages_channel_channel__ = __webpack_require__(52);
380
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pages_channel_channel__ = __webpack_require__(54);
507 381
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__ionic_native_status_bar__ = __webpack_require__(201);
508 382
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__ionic_native_splash_screen__ = __webpack_require__(204);
509 383
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__providers_user_user__ = __webpack_require__(47);
510 384
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__angular_common_http__ = __webpack_require__(278);
511
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__angular_http__ = __webpack_require__(46);
512
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__providers_message_message__ = __webpack_require__(160);
513
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__providers_channel_channel__ = __webpack_require__(161);
514
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__providers_url_url__ = __webpack_require__(80);
515
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__pages_register_register__ = __webpack_require__(105);
516
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__pages_create_channel_create_channel__ = __webpack_require__(104);
517
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__pages_all_channels_all_channels__ = __webpack_require__(103);
385
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__angular_http__ = __webpack_require__(48);
386
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__providers_message_message__ = __webpack_require__(82);
387
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__providers_channel_channel__ = __webpack_require__(30);
388
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__providers_url_url__ = __webpack_require__(49);
389
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__pages_register_register__ = __webpack_require__(107);
390
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__pages_create_channel_create_channel__ = __webpack_require__(106);
391
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__pages_all_channels_all_channels__ = __webpack_require__(105);
518 392
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
519 393
     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
520 394
     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -559,8 +433,8 @@ var AppModule = /** @class */ (function () {
559 433
                     links: [
560 434
                         { loadChildren: '../pages/all-channels/all-channels.module#AllChannelsPageModule', name: 'AllChannelsPage', segment: 'all-channels', priority: 'low', defaultHistory: [] },
561 435
                         { loadChildren: '../pages/create-channel/create-channel.module#CreateChannelPageModule', name: 'CreateChannelPage', segment: 'create-channel', priority: 'low', defaultHistory: [] },
562
-                        { loadChildren: '../pages/channel/channel.module#ChannelPageModule', name: 'ChannelPage', segment: 'channel', priority: 'low', defaultHistory: [] },
563
-                        { loadChildren: '../pages/register/register.module#RegisterPageModule', name: 'RegisterPage', segment: 'register', priority: 'low', defaultHistory: [] }
436
+                        { loadChildren: '../pages/register/register.module#RegisterPageModule', name: 'RegisterPage', segment: 'register', priority: 'low', defaultHistory: [] },
437
+                        { loadChildren: '../pages/channel/channel.module#ChannelPageModule', name: 'ChannelPage', segment: 'channel', priority: 'low', defaultHistory: [] }
564 438
                     ]
565 439
                 }),
566 440
                 __WEBPACK_IMPORTED_MODULE_10__angular_common_http__["a" /* HttpClientModule */],
@@ -605,9 +479,11 @@ var AppModule = /** @class */ (function () {
605 479
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ionic_native_splash_screen__ = __webpack_require__(204);
606 480
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__pages_home_home__ = __webpack_require__(205);
607 481
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__pages_list_list__ = __webpack_require__(206);
608
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pages_channel_channel__ = __webpack_require__(52);
609
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__pages_create_channel_create_channel__ = __webpack_require__(104);
610
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__pages_all_channels_all_channels__ = __webpack_require__(103);
482
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__pages_channel_channel__ = __webpack_require__(54);
483
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__pages_create_channel_create_channel__ = __webpack_require__(106);
484
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__pages_all_channels_all_channels__ = __webpack_require__(105);
485
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__providers_channel_channel__ = __webpack_require__(30);
486
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__providers_message_message__ = __webpack_require__(82);
611 487
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
612 488
     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
613 489
     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -626,11 +502,15 @@ var __metadata = (this && this.__metadata) || function (k, v) {
626 502
 
627 503
 
628 504
 
505
+
506
+
629 507
 var MyApp = /** @class */ (function () {
630
-    function MyApp(platform, statusBar, splashScreen) {
508
+    function MyApp(platform, statusBar, splashScreen, channelProvider, messageProvider) {
631 509
         this.platform = platform;
632 510
         this.statusBar = statusBar;
633 511
         this.splashScreen = splashScreen;
512
+        this.channelProvider = channelProvider;
513
+        this.messageProvider = messageProvider;
634 514
         this.rootPage = __WEBPACK_IMPORTED_MODULE_4__pages_home_home__["a" /* HomePage */];
635 515
         this.initializeApp();
636 516
         // used for an example of ngFor and navigation
@@ -648,6 +528,13 @@ var MyApp = /** @class */ (function () {
648 528
             _this.statusBar.styleDefault();
649 529
             _this.splashScreen.hide();
650 530
         });
531
+        this.channelProvider.userChannels;
532
+    };
533
+    MyApp.prototype.setChannel = function (channel) {
534
+        this.channelProvider.channel = channel;
535
+        console.log(this.channelProvider.channel);
536
+        this.messageProvider.get(function (result) {
537
+        });
651 538
     };
652 539
     MyApp.prototype.openPage = function (page) {
653 540
         // Reset the content nav to have just this page
@@ -671,9 +558,13 @@ var MyApp = /** @class */ (function () {
671 558
         __metadata("design:type", __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["f" /* Nav */])
672 559
     ], MyApp.prototype, "nav", void 0);
673 560
     MyApp = __decorate([
674
-        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({template:/*ion-inline-start:"/Users/jaehoonp/ZipTeamPurple-FrontEnd/src/app/app.html"*/'<ion-menu [content]="content">\n\n  <ion-header>\n    <ion-toolbar>\n      <ion-title>Zip-Slack</ion-title>\n    </ion-toolbar>\n  </ion-header>\n\n  <ion-content>\n    <ion-list>\n\n      \n\n      <button menuClose ion-item *ngFor="" (click)="openPage(p)">\n        \n      </button>\n\n      \n\n      <ion-list-header>\n          <h2>Channels</h2>\n        </ion-list-header>\n\n        <!-- <ion-item (click)="openPage(ChannelPage)">General Channel</ion-item> -->\n        <ion-item menuClose (click)="openChannelPage()">General Channel</ion-item>\n\n        <button menuClose ion-button color="light" type="button"(click)="openCreateChannelPage()" round>+ New Channel</button>\n        \n\n        <!-- View All Channels button -->\n        <button menuClose ion-button color="light" type="button"(click)="openAllChannelsPage()" round>\n          <div><ion-icon name="eye" style="padding-right: 5px;"></ion-icon>  </div> \n          View All Channels\n        </button>\n\n\n        <ion-list-header>\n            Direct messages\n          </ion-list-header>\n\n          <ion-item (click)="openPage(ChannelPage)">nmaidanos</ion-item>\n          <ion-item (click)="openPage(ChannelPage)">Small_Wrld</ion-item>\n\n          <button ion-button color="light" type="button" (click)="openPage(Channel)">+ New Direct Message</button>\n          \n\n\n\n          <ion-footer text-center>\n\n              <button menuClose ion-button color="danger" type="submit" (click)="backToLoginPage()" round>Logout</button>\n\n          </ion-footer>\n\n\n\n          \n    </ion-list>\n\n\n\n\n\n\n  </ion-content>\n\n</ion-menu>\n\n<!-- Disable swipe-to-go-back because it\'s poor UX to combine STGB with side menus -->\n<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>\n'/*ion-inline-end:"/Users/jaehoonp/ZipTeamPurple-FrontEnd/src/app/app.html"*/
561
+        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({template:/*ion-inline-start:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/app/app.html"*/'<ion-menu [content]="content">\n\n  <ion-header>\n    <ion-toolbar>\n      <ion-title>Zip-Slack</ion-title>\n    </ion-toolbar>\n  </ion-header>\n\n  <ion-content>\n    <ion-list>\n\n      \n\n      <button menuClose ion-item *ngFor="" (click)="openPage(p)">\n        \n      </button>\n\n      \n\n      <ion-list-header>\n          <h2>Channels</h2>\n        </ion-list-header>\n\n        <!-- <ion-item (click)="openPage(ChannelPage)">General Channel</ion-item> -->\n        <ion-item menuClose *ngFor="let channel of this.channelProvider.userChannels" (click)="setChannel(channel)">\n          {{ channel.name }}\n        </ion-item>\n\n        <button menuClose ion-button color="light" type="button"(click)="openCreateChannelPage()" round>+ New Channel</button>\n        \n\n        <!-- View All Channels button -->\n        <button menuClose ion-button color="light" type="button"(click)="openAllChannelsPage()" round>\n          <div><ion-icon name="eye" style="padding-right: 5px;"></ion-icon>  </div> \n          View All Channels\n        </button>\n\n<!-- \n        <ion-list-header>\n            Direct messages\n          </ion-list-header>\n\n          <ion-item (click)="openPage(ChannelPage)">nmaidanos</ion-item>\n          <ion-item (click)="openPage(ChannelPage)">Small_Wrld</ion-item>\n\n          <button ion-button color="light" type="button" (click)="openPage(Channel)">+ New Direct Message</button>\n           -->\n\n\n\n          <ion-footer text-center>\n\n              <button menuClose ion-button color="danger" type="submit" (click)="backToLoginPage()" round>Logout</button>\n\n          </ion-footer>\n\n\n\n          \n    </ion-list>\n\n\n\n\n\n\n  </ion-content>\n\n</ion-menu>\n\n<!-- Disable swipe-to-go-back because it\'s poor UX to combine STGB with side menus -->\n<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>\n'/*ion-inline-end:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/app/app.html"*/
675 562
         }),
676
-        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["i" /* Platform */], __WEBPACK_IMPORTED_MODULE_2__ionic_native_status_bar__["a" /* StatusBar */], __WEBPACK_IMPORTED_MODULE_3__ionic_native_splash_screen__["a" /* SplashScreen */]])
563
+        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["i" /* Platform */],
564
+            __WEBPACK_IMPORTED_MODULE_2__ionic_native_status_bar__["a" /* StatusBar */],
565
+            __WEBPACK_IMPORTED_MODULE_3__ionic_native_splash_screen__["a" /* SplashScreen */],
566
+            __WEBPACK_IMPORTED_MODULE_9__providers_channel_channel__["a" /* ChannelProvider */],
567
+            __WEBPACK_IMPORTED_MODULE_10__providers_message_message__["a" /* MessageProvider */]])
677 568
     ], MyApp);
678 569
     return MyApp;
679 570
 }());
@@ -682,14 +573,150 @@ var MyApp = /** @class */ (function () {
682 573
 
683 574
 /***/ }),
684 575
 
576
+/***/ 30:
577
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
578
+
579
+"use strict";
580
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ChannelProvider; });
581
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
582
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__user_user__ = __webpack_require__(47);
583
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__ = __webpack_require__(48);
584
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__url_url__ = __webpack_require__(49);
585
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
586
+    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
587
+    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
588
+    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
589
+    return c > 3 && r && Object.defineProperty(target, key, r), r;
590
+};
591
+var __metadata = (this && this.__metadata) || function (k, v) {
592
+    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
593
+};
594
+
595
+
596
+
597
+
598
+/*
599
+  Generated class for the ChannelProvider provider.
600
+
601
+  See https://angular.io/guide/dependency-injection for more info on providers
602
+  and Angular DI.
603
+*/
604
+var ChannelProvider = /** @class */ (function () {
605
+    function ChannelProvider(http, userProvider, urlProvider) {
606
+        this.http = http;
607
+        this.userProvider = userProvider;
608
+        this.urlProvider = urlProvider;
609
+        this.channel = { "id": 1 };
610
+        this.userChannels = [];
611
+        this.allChannels = [];
612
+        //console.log('Hello ChannelProvider Provider');
613
+    }
614
+    /////////////////////////////////////
615
+    ChannelProvider.prototype.getUserChannels = function () {
616
+        return this.userChannels;
617
+    };
618
+    ChannelProvider.prototype.setUserChannels = function (userChannels) {
619
+        this.userChannels = userChannels;
620
+    };
621
+    ChannelProvider.prototype.getAllChannels = function () {
622
+        return this.allChannels;
623
+    };
624
+    ChannelProvider.prototype.setAllChannels = function (allChannels) {
625
+        this.allChannels = allChannels;
626
+    };
627
+    ///////////////////////////////////
628
+    ChannelProvider.prototype.create = function (name, callback) {
629
+        var _this = this;
630
+        var url = this.urlProvider.getBaseUrl() + "/post_channel";
631
+        var header = new __WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["a" /* Headers */]({
632
+            'Authorization': this.userProvider.getToken(),
633
+            'Content-Type': 'application/json'
634
+        });
635
+        var options = new __WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["d" /* RequestOptions */]({ headers: header });
636
+        var body = {
637
+            "purpose": "test",
638
+            "private": true,
639
+            "name": name,
640
+        };
641
+        this.http.post(url, body, options).subscribe(function (result) {
642
+            console.log(result);
643
+            _this.fetch();
644
+            callback(result);
645
+        });
646
+    };
647
+    ChannelProvider.prototype.fetch = function () {
648
+        var _this = this;
649
+        this.fetchUserChannels(function (userChannels) {
650
+            _this.userChannels = userChannels;
651
+            _this.fetchAllChannels(function (allChannels) {
652
+                _this.allChannels = allChannels;
653
+                console.log(allChannels);
654
+                console.log(userChannels);
655
+            });
656
+        });
657
+    };
658
+    ChannelProvider.prototype.fetchUserChannels = function (callback) {
659
+        var url = this.urlProvider.getBaseUrl() + "/user_channels";
660
+        var header = new __WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["a" /* Headers */]({
661
+            'Authorization': this.userProvider.getToken(),
662
+            'Content-Type': 'application/json'
663
+        });
664
+        var options = new __WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["d" /* RequestOptions */]({ headers: header });
665
+        this.http.get(url, options).subscribe(function (result) {
666
+            //console.log(result);
667
+            callback(result.json());
668
+        });
669
+    };
670
+    ChannelProvider.prototype.fetchAllChannels = function (callback) {
671
+        var url = this.urlProvider.getBaseUrl() + "/get_channels";
672
+        var header = new __WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["a" /* Headers */]({
673
+            'Authorization': this.userProvider.getToken(),
674
+            'Content-Type': 'application/json'
675
+        });
676
+        var options = new __WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["d" /* RequestOptions */]({ headers: header });
677
+        this.http.get(url, options).subscribe(function (result) {
678
+            //console.log(result);
679
+            callback(result.json());
680
+        });
681
+    };
682
+    ChannelProvider.prototype.join = function (channel, callback) {
683
+        var _this = this;
684
+        var url = this.urlProvider.getBaseUrl() + "/add_user";
685
+        var header = new __WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["a" /* Headers */]({
686
+            'Authorization': this.userProvider.getToken(),
687
+            'Content-Type': 'application/json'
688
+        });
689
+        var options = new __WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["d" /* RequestOptions */]({ headers: header });
690
+        var body = {
691
+            "id": channel.id,
692
+        };
693
+        this.http.post(url, body, options).subscribe(function (result) {
694
+            console.log(result);
695
+            _this.fetch();
696
+            callback(result);
697
+        });
698
+    };
699
+    ChannelProvider = __decorate([
700
+        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */])(),
701
+        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_2__node_modules_angular_http__["b" /* Http */],
702
+            __WEBPACK_IMPORTED_MODULE_1__user_user__["a" /* UserProvider */],
703
+            __WEBPACK_IMPORTED_MODULE_3__url_url__["a" /* UrlProvider */]])
704
+    ], ChannelProvider);
705
+    return ChannelProvider;
706
+}());
707
+
708
+//# sourceMappingURL=channel.js.map
709
+
710
+/***/ }),
711
+
685 712
 /***/ 47:
686 713
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
687 714
 
688 715
 "use strict";
689 716
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UserProvider; });
690 717
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
691
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_http__ = __webpack_require__(46);
692
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__url_url__ = __webpack_require__(80);
718
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_http__ = __webpack_require__(48);
719
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__url_url__ = __webpack_require__(49);
693 720
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
694 721
     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
695 722
     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -743,15 +770,58 @@ var UserProvider = /** @class */ (function () {
743 770
 
744 771
 /***/ }),
745 772
 
746
-/***/ 52:
773
+/***/ 49:
774
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
775
+
776
+"use strict";
777
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UrlProvider; });
778
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
779
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
780
+    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
781
+    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
782
+    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
783
+    return c > 3 && r && Object.defineProperty(target, key, r), r;
784
+};
785
+
786
+/*
787
+  Generated class for the UrlProvider provider.
788
+
789
+  See https://angular.io/guide/dependency-injection for more info on providers
790
+  and Angular DI.
791
+*/
792
+var UrlProvider = /** @class */ (function () {
793
+    function UrlProvider() {
794
+        // constructor(public http: HttpClient) {
795
+        //   console.log('Hello UrlProvider Provider');
796
+        // }
797
+        this.baseUrl = "http://localhost:8080";
798
+    }
799
+    //private baseUrl = "https://zipteampurple.herokuapp.com";
800
+    UrlProvider.prototype.setBaseUrl = function (baseUrl) {
801
+        this.baseUrl = baseUrl;
802
+    };
803
+    UrlProvider.prototype.getBaseUrl = function () {
804
+        return this.baseUrl;
805
+    };
806
+    UrlProvider = __decorate([
807
+        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */])()
808
+    ], UrlProvider);
809
+    return UrlProvider;
810
+}());
811
+
812
+//# sourceMappingURL=url.js.map
813
+
814
+/***/ }),
815
+
816
+/***/ 54:
747 817
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
748 818
 
749 819
 "use strict";
750 820
 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ChannelPage; });
751 821
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
752 822
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_ionic_angular__ = __webpack_require__(20);
753
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__providers_message_message__ = __webpack_require__(160);
754
-/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__providers_channel_channel__ = __webpack_require__(161);
823
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__providers_message_message__ = __webpack_require__(82);
824
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__providers_channel_channel__ = __webpack_require__(30);
755 825
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
756 826
     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
757 827
     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -779,10 +849,11 @@ var ChannelPage = /** @class */ (function () {
779 849
         this.messageProvider = messageProvider;
780 850
         this.channelProvider = channelProvider;
781 851
         this.messages = [];
782
-        this.channels = [];
783 852
         this.currentChannel = { "id": 1 };
784
-        this.getMessages();
785
-        this.getChannels();
853
+        //this.getMessages();
854
+        this.messageProvider.get(function (result) {
855
+        });
856
+        //this.getChannels();
786 857
     }
787 858
     ChannelPage.prototype.setCurrentChannel = function (currentChannel) {
788 859
         this.currentChannel = currentChannel;
@@ -792,34 +863,33 @@ var ChannelPage = /** @class */ (function () {
792 863
     };
793 864
     ChannelPage.prototype.ionViewDidLoad = function () {
794 865
         console.log('ionViewDidLoad ChannelPage');
795
-        this.start();
866
+        //this.start();
796 867
     };
797 868
     ChannelPage.prototype.start = function () {
798 869
         var _this = this;
799 870
         this.timerToken = setInterval(function () { return _this.runningLoopOfMessages(_this.channelProvider); }, 5000);
800 871
     };
801 872
     ChannelPage.prototype.getMessages = function () {
802
-        var _this = this;
803
-        this.messageProvider.get(1, function (after) {
804
-            _this.messages = after.json();
873
+        this.messageProvider.get(function (result) {
805 874
         });
806 875
     };
807
-    ChannelPage.prototype.getChannels = function () {
808
-        var _this = this;
809
-        this.timerToken = setInterval(this.channelProvider.get(function (channels) {
810
-            _this.channels = channels;
811
-        }), 5000);
812
-    };
876
+    // getChannels(){
877
+    //   this.timerToken = setInterval(this.channelProvider.getuser(channels => {
878
+    //     this.channels = channels;
879
+    //   }), 5000);
880
+    // }
813 881
     ChannelPage.prototype.runningLoopOfMessages = function (channelProvider) {
814 882
         var _this = this;
815
-        this.messageProvider.get(1, function (after) {
883
+        this.messageProvider.get(function (after) {
816 884
             _this.messages = after.json();
817 885
         });
818 886
     };
819 887
     ChannelPage.prototype.deleteMessage = function (messageId) {
820 888
         var _this = this;
821 889
         this.messageProvider.delete(messageId, function (after) {
822
-            _this.getMessages();
890
+            _this.messageProvider.get(function (callback) {
891
+                console.log(callback);
892
+            });
823 893
         });
824 894
     };
825 895
     // sendMessage(){
@@ -857,67 +927,129 @@ var ChannelPage = /** @class */ (function () {
857 927
         var _this = this;
858 928
         if (!this.message.trim())
859 929
             return;
860
-        this.messageProvider.post(1, this.message, function (after) {
930
+        this.messageProvider.post(this.channelProvider.channel.id, this.message, function (after) {
861 931
             _this.message = '';
862 932
             _this.getMessages();
863 933
         });
864 934
     };
865 935
     ChannelPage = __decorate([
866 936
         Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({
867
-            selector: 'page-channel',template:/*ion-inline-start:"/Users/jaehoonp/ZipTeamPurple-FrontEnd/src/pages/channel/channel.html"*/'\n\n\n<!-- <ion-buttons start>\n\n  <button ion-button icon-only menuToggle>\n\n    <ion-icon name="menu"></ion-icon>\n\n  </button>\n\n</ion-buttons> -->\n\n<ion-header>\n\n  <ion-navbar>\n    <ion-title>Channel</ion-title>\n\n    <ion-buttons start>\n\n        <button ion-button icon-only menuToggle>\n          <ion-icon name="menu"></ion-icon>\n        </button>\n        <!-- <button ion-button (click)="sendMessage()">\n          <ion-icon name="add"></ion-icon>\n        </button> -->\n        <button ion-button (click)="getMessages()">\n          <ion-icon name="refresh"></ion-icon>\n        </button>\n      \n      </ion-buttons>\n  </ion-navbar>\n\n</ion-header>\n\n\n\n<ion-content padding>\n\n\n    <!-- <ion-list padding>\n        <h1>Channels</h1>\n        <ion-item-sliding *ngFor="let channel of channels">\n            <ion-item>{{channel.name}}</ion-item>\n\n          <ion-item-options side="right">\n              <button ion-button>\n                  <ion-icon name="settings"></ion-icon>\n                </button>\n              <button color="danger" ion-button (click)="deleteMessage(message.id)">\n                <ion-icon name="trash"></ion-icon>\n              </button>\n     \n          </ion-item-options>\n        </ion-item-sliding>\n\n        <button>Create new Channel</button>\n        \n        <ion-item>Todo 2</ion-item>\n        <ion-item>Todo 3</ion-item>\n      </ion-list> -->\n\n    <ion-list padding>\n      <ion-item-sliding *ngFor="let message of messages">\n          <ion-item>{{message.user.username}} - {{message.message}}</ion-item>\n    \n        <ion-item-options side="right">\n            <button ion-button>\n                <ion-icon name="settings"></ion-icon>\n              </button>\n            <button color="danger" ion-button (click)="deleteMessage(message.id)">\n              <ion-icon name="trash"></ion-icon>\n            </button>\n   \n        </ion-item-options>\n      </ion-item-sliding>\n\n\n\n\n\n\n      <ion-footer>\n\n        <ion-item >\n\n          <ion-input #chat_input\n          type="text"\n          placeholder="Text Input"\n          [(ngModel)]="message"\n          (keyup.enter)="sendMessage()"\n          >\n\n          </ion-input>\n\n        </ion-item>\n\n\n\n          <!-- <textarea #chat_input\n          placeholder="Text Input"\n          [(ngModel)]="message"\n          (keyup.enter)="sendMessage()"\n          >\n          </textarea> -->\n  \n\n\n          <!-- Do we need to keep this button?\n          <button ion-button clear icon-only item-right (click)="sendMessage()">\n          <ion-icon name="ios-send" ios="ios-send" md="md-send"></ion-icon>\n          </button> -->\n  \n      </ion-footer>\n\n\n\n\n    </ion-list>\n\n\n    \n   \n   </ion-content>\n\n\n'/*ion-inline-end:"/Users/jaehoonp/ZipTeamPurple-FrontEnd/src/pages/channel/channel.html"*/,
937
+            selector: 'page-channel',template:/*ion-inline-start:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/channel/channel.html"*/'\n\n\n<!-- <ion-buttons start>\n\n  <button ion-button icon-only menuToggle>\n\n    <ion-icon name="menu"></ion-icon>\n\n  </button>\n\n</ion-buttons> -->\n\n<ion-header>\n\n  <ion-navbar>\n    <ion-title>Channel</ion-title>\n\n    <ion-buttons start>\n\n        <button ion-button icon-only menuToggle>\n          <ion-icon name="menu"></ion-icon>\n        </button>\n        <!-- <button ion-button (click)="sendMessage()">\n          <ion-icon name="add"></ion-icon>\n        </button> -->\n        <button ion-button (click)="getMessages()">\n          <ion-icon name="refresh"></ion-icon>\n        </button>\n      \n      </ion-buttons>\n  </ion-navbar>\n\n</ion-header>\n\n\n\n<ion-content padding>\n\n\n    <!-- <ion-list padding>\n        <h1>Channels</h1>\n        <ion-item-sliding *ngFor="let channel of channels">\n            <ion-item>{{channel.name}}</ion-item>\n\n          <ion-item-options side="right">\n              <button ion-button>\n                  <ion-icon name="settings"></ion-icon>\n                </button>\n              <button color="danger" ion-button (click)="deleteMessage(message.id)">\n                <ion-icon name="trash"></ion-icon>\n              </button>\n     \n          </ion-item-options>\n        </ion-item-sliding>\n\n        <button>Create new Channel</button>\n        \n        <ion-item>Todo 2</ion-item>\n        <ion-item>Todo 3</ion-item>\n      </ion-list> -->\n\n    <ion-list padding>\n      <ion-item-sliding *ngFor="let message of this.messageProvider.messages">\n          <ion-item>{{message.user.username}} - {{message.message}}</ion-item>\n    \n        <ion-item-options side="right">\n            <button ion-button>\n                <ion-icon name="settings"></ion-icon>\n              </button>\n            <button color="danger" ion-button (click)="deleteMessage(message.id)">\n              <ion-icon name="trash"></ion-icon>\n            </button>\n   \n        </ion-item-options>\n      </ion-item-sliding>\n\n\n\n\n\n\n      <ion-footer>\n\n        <ion-item >\n\n          <ion-input #chat_input\n          type="text"\n          placeholder="Text Input"\n          [(ngModel)]="message"\n          (keyup.enter)="sendMessage()"\n          >\n\n          </ion-input>\n\n        </ion-item>\n\n\n\n          <!-- <textarea #chat_input\n          placeholder="Text Input"\n          [(ngModel)]="message"\n          (keyup.enter)="sendMessage()"\n          >\n          </textarea> -->\n  \n\n\n          <!-- Do we need to keep this button?\n          <button ion-button clear icon-only item-right (click)="sendMessage()">\n          <ion-icon name="ios-send" ios="ios-send" md="md-send"></ion-icon>\n          </button> -->\n  \n      </ion-footer>\n\n\n\n\n    </ion-list>\n\n\n    \n   \n   </ion-content>\n\n\n'/*ion-inline-end:"/Users/nicholasm/Labs/ZipTeamPurple-FrontEnd/src/pages/channel/channel.html"*/,
868 938
         }),
869
-        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["g" /* NavController */], __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["h" /* NavParams */],
870
-            __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["a" /* AlertController */],
871
-            __WEBPACK_IMPORTED_MODULE_2__providers_message_message__["a" /* MessageProvider */],
872
-            __WEBPACK_IMPORTED_MODULE_3__providers_channel_channel__["a" /* ChannelProvider */]])
939
+        __metadata("design:paramtypes", [typeof (_a = typeof __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["g" /* NavController */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["g" /* NavController */]) === "function" && _a || Object, typeof (_b = typeof __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["h" /* NavParams */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["h" /* NavParams */]) === "function" && _b || Object, typeof (_c = typeof __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["a" /* AlertController */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["a" /* AlertController */]) === "function" && _c || Object, typeof (_d = typeof __WEBPACK_IMPORTED_MODULE_2__providers_message_message__["a" /* MessageProvider */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_2__providers_message_message__["a" /* MessageProvider */]) === "function" && _d || Object, typeof (_e = typeof __WEBPACK_IMPORTED_MODULE_3__providers_channel_channel__["a" /* ChannelProvider */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_3__providers_channel_channel__["a" /* ChannelProvider */]) === "function" && _e || Object])
873 940
     ], ChannelPage);
874 941
     return ChannelPage;
942
+    var _a, _b, _c, _d, _e;
875 943
 }());
876 944
 
877 945
 //# sourceMappingURL=channel.js.map
878 946
 
879 947
 /***/ }),
880 948
 
881
-/***/ 80:
949
+/***/ 82:
882 950
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
883 951
 
884 952
 "use strict";
885
-/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UrlProvider; });
953
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MessageProvider; });
886 954
 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
955
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_http__ = __webpack_require__(48);
956
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__user_user__ = __webpack_require__(47);
957
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__url_url__ = __webpack_require__(49);
958
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__channel_channel__ = __webpack_require__(30);
887 959
 var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
888 960
     var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
889 961
     if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
890 962
     else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
891 963
     return c > 3 && r && Object.defineProperty(target, key, r), r;
892 964
 };
965
+var __metadata = (this && this.__metadata) || function (k, v) {
966
+    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
967
+};
968
+
969
+
970
+
971
+
893 972
 
894 973
 /*
895
-  Generated class for the UrlProvider provider.
974
+  Generated class for the MessageProvider provider.
896 975
 
897 976
   See https://angular.io/guide/dependency-injection for more info on providers
898 977
   and Angular DI.
899 978
 */
900
-var UrlProvider = /** @class */ (function () {
901
-    function UrlProvider() {
902
-        // constructor(public http: HttpClient) {
903
-        //   console.log('Hello UrlProvider Provider');
904
-        // }
905
-        //private baseUrl = "http://localhost:8080";
906
-        this.baseUrl = "https://zipteampurple.herokuapp.com";
979
+var MessageProvider = /** @class */ (function () {
980
+    function MessageProvider(http, userProvider, urlProvider, channelProvider) {
981
+        this.http = http;
982
+        this.userProvider = userProvider;
983
+        this.urlProvider = urlProvider;
984
+        this.channelProvider = channelProvider;
985
+        this.messages = [];
986
+        console.log('Hello MessageProvider Provider');
907 987
     }
908
-    UrlProvider.prototype.setBaseUrl = function (baseUrl) {
909
-        this.baseUrl = baseUrl;
988
+    MessageProvider.prototype.getAll = function () {
989
+        var url = this.urlProvider.getBaseUrl() + "/get_messages";
990
+        var header = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["a" /* Headers */]({
991
+            'Authorization': this.userProvider.getToken()
992
+        });
993
+        var options = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["d" /* RequestOptions */]({ headers: header });
994
+        this.http.get(url, options).subscribe(function (result) {
995
+            console.log(result);
996
+        });
910 997
     };
911
-    UrlProvider.prototype.getBaseUrl = function () {
912
-        return this.baseUrl;
998
+    MessageProvider.prototype.post = function (channelId, message, callback) {
999
+        var _this = this;
1000
+        var url = this.urlProvider.getBaseUrl() + "/post";
1001
+        var header = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["a" /* Headers */]({
1002
+            'Authorization': this.userProvider.getToken(),
1003
+            'Content-Type': 'application/json'
1004
+        });
1005
+        var options = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["d" /* RequestOptions */]({ headers: header });
1006
+        var body = {
1007
+            "channelId": channelId,
1008
+            "message": message
1009
+        };
1010
+        this.http.post(url, body, options).subscribe(function (result) {
1011
+            console.log(result);
1012
+            _this.get(function (after) {
1013
+                callback();
1014
+            });
1015
+        });
913 1016
     };
914
-    UrlProvider = __decorate([
915
-        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */])()
916
-    ], UrlProvider);
917
-    return UrlProvider;
1017
+    MessageProvider.prototype.get = function (callback) {
1018
+        var _this = this;
1019
+        var url = this.urlProvider.getBaseUrl() + "/messages?channelId=" + this.channelProvider.channel.id;
1020
+        var header = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["a" /* Headers */]({
1021
+            'Authorization': this.userProvider.getToken(),
1022
+            'Content-Type': 'application/json'
1023
+        });
1024
+        console.log(url);
1025
+        var options = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["d" /* RequestOptions */]({ headers: header });
1026
+        this.http.get(url, options).subscribe(function (result) {
1027
+            console.log(result);
1028
+            _this.messages = result.json();
1029
+            callback(result);
1030
+        });
1031
+    };
1032
+    MessageProvider.prototype.delete = function (messageId, callback) {
1033
+        var url = this.urlProvider.getBaseUrl() + "/delete?messageId=" + messageId;
1034
+        var header = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["a" /* Headers */]({
1035
+            'Authorization': this.userProvider.getToken(),
1036
+            'Content-Type': 'application/json'
1037
+        });
1038
+        var options = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["d" /* RequestOptions */]({ headers: header });
1039
+        this.http.delete(url, options).subscribe(function (result) {
1040
+            console.log(result);
1041
+            callback();
1042
+        });
1043
+    };
1044
+    MessageProvider = __decorate([
1045
+        Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */])(),
1046
+        __metadata("design:paramtypes", [typeof (_a = typeof __WEBPACK_IMPORTED_MODULE_1__angular_http__["b" /* Http */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_1__angular_http__["b" /* Http */]) === "function" && _a || Object, typeof (_b = typeof __WEBPACK_IMPORTED_MODULE_2__user_user__["a" /* UserProvider */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_2__user_user__["a" /* UserProvider */]) === "function" && _b || Object, typeof (_c = typeof __WEBPACK_IMPORTED_MODULE_3__url_url__["a" /* UrlProvider */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_3__url_url__["a" /* UrlProvider */]) === "function" && _c || Object, typeof (_d = typeof __WEBPACK_IMPORTED_MODULE_4__channel_channel__["a" /* ChannelProvider */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_4__channel_channel__["a" /* ChannelProvider */]) === "function" && _d || Object])
1047
+    ], MessageProvider);
1048
+    return MessageProvider;
1049
+    var _a, _b, _c, _d;
918 1050
 }());
919 1051
 
920
-//# sourceMappingURL=url.js.map
1052
+//# sourceMappingURL=message.js.map
921 1053
 
922 1054
 /***/ })
923 1055
 

+ 1
- 1
www/build/main.js.map
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 477
- 477
www/build/vendor.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 1
- 1
www/build/vendor.js.map
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu