daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Jan 13th, 2018 245 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   // Initialize Firebase
  2.   var config = {
  3.     apiKey: "AIzaSyAkkFZ-0-J3ZZ3itWg5SRdzKmaQuzxn0uY",
  4.     authDomain: "codenamepasto.firebaseapp.com",
  5.     databaseURL: "https://codenamepasto.firebaseio.com",
  6.     projectId: "codenamepasto",
  7.     storageBucket: "codenamepasto.appspot.com",
  8.     messagingSenderId: "279727114701"
  9. };
  10.  
  11. function createNewUser(userId, name, email) {
  12.   firebase.database().ref('users/' + userId).set({
  13.     username: name,
  14.     email: email
  15.   });
  16. }
  17.  
  18. function createNewLeague(userLeagueId, userLeagueSubs, userOwnerName) {
  19.   firebase.database().ref('userLeagues/' + userLeagueId).set({
  20.     league: userLeagueSubs,
  21.     userOwner: userOwnerName,
  22.   });
  23.   firebase.database().ref('userLeagues/' + userLeagueId + '/users').set({
  24.     [userOwnerName] : true
  25.       });
  26. }
RAW Paste Data
Top