File tree Expand file tree Collapse file tree 2 files changed +51
-9
lines changed Expand file tree Collapse file tree 2 files changed +51
-9
lines changed Original file line number Diff line number Diff line change 11const functions = require ( 'firebase-functions' ) ;
2+ const admin = require ( 'firebase-admin' ) ;
23
3- // // Create and Deploy Your First Cloud Functions
4- // // https://firebase.google.com/docs/functions/write-firebase-functions
5- //
6- // exports.helloWorld = functions.https.onRequest((request, response) => {
7- // response.send("Hello from Firebase!");
8- // });
4+ admin . initializeApp ( functions . config ( ) . firebase )
5+
6+ exports . helloWorld = functions . https . onRequest ( ( request , response ) => {
7+ response . send ( "Hello, amigos!" ) ;
8+ } ) ;
9+
10+ const createNotification = ( notification => {
11+
12+ return admin . firestore ( ) . collection ( 'notifications' )
13+ . add ( notification )
14+ . then ( doc => {
15+ console . log ( 'notofication added' , doc )
16+ } )
17+ } )
18+
19+ exports . projectCreated =
20+ functions . firestore . document ( 'projects/{projectId}' ) . onCreate ( doc => {
21+
22+ const project = doc . data ( ) ;
23+ const notification = {
24+ content : 'Added a new Project' ,
25+ user : `${ project . authorFirstName } ${ project . authorLastName } ` ,
26+ time : admin . firestore . FieldValue . serverTimestamp ( )
27+ }
28+
29+ return createNotification ( notification ) ;
30+ } )
Original file line number Diff line number Diff line change 11import React from 'react'
22
3- const Notifications = ( ) => {
3+ const Notifications = ( props ) => {
44
55 return (
6- < div >
7- < p > Notifications</ p >
6+ < div className = "section" >
7+ < div className = "card z-depth-0" >
8+ < div className = "card-content" >
9+ < span className = "card-title" >
10+ Notifications
11+ </ span >
12+ < ul className = "notifications" >
13+ < li >
14+ Notification
15+ </ li >
16+ < li >
17+ Notification
18+ </ li >
19+ < li >
20+ Notification
21+ </ li >
22+ < li >
23+ Notification
24+ </ li >
25+ </ ul >
26+ </ div >
27+ </ div >
828 </ div >
929 )
1030}
You can’t perform that action at this time.
0 commit comments