Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "longshotauth"
}
}
6 changes: 6 additions & 0 deletions database.rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"rules": {
".read": true,
".write": true
}
}
171 changes: 171 additions & 0 deletions firebase-debug.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
[debug] [2018-01-21T01:44:01.954Z] ----------------------------------------------------------------------
[debug] [2018-01-21T01:44:01.958Z] Command: /usr/local/Cellar/node/8.5.0/bin/node /usr/local/bin/firebase serve
[debug] [2018-01-21T01:44:01.958Z] CLI Version: 3.17.3
[debug] [2018-01-21T01:44:01.958Z] Platform: darwin
[debug] [2018-01-21T01:44:01.958Z] Node Version: v8.5.0
[debug] [2018-01-21T01:44:01.964Z] Time: Sat Jan 20 2018 19:44:01 GMT-0600 (CST)
[debug] [2018-01-21T01:44:01.964Z] ----------------------------------------------------------------------
[debug]
[debug] [2018-01-21T01:44:01.973Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2018-01-21T01:44:01.974Z] > authorizing via signed-in user
[debug] [2018-01-21T01:44:01.975Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2018-01-21T01:44:01.975Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
{ refresh_token: '1/8xsTvQfVvHXSipMTAJzSy5uhqtUWBrPoQXaMsT79kRw',
client_id: '563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com',
client_secret: 'j9iVZfS8kkCEFUPaAeJV0sAi',
grant_type: 'refresh_token',
scope: 'email https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/firebase openid' }
Sat Jan 20 2018 19:44:01 GMT-0600 (CST)
[debug] [2018-01-21T01:44:02.179Z] <<< HTTP RESPONSE 200
[debug] [2018-01-21T01:44:02.197Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/longshotauth

Sat Jan 20 2018 19:44:02 GMT-0600 (CST)
[debug] [2018-01-21T01:44:02.518Z] <<< HTTP RESPONSE 200
[debug] [2018-01-21T01:44:02.519Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/longshotauth/tokens

Sat Jan 20 2018 19:44:02 GMT-0600 (CST)
[debug] [2018-01-21T01:44:03.163Z] <<< HTTP RESPONSE 200
[info]
[info] === Serving from '/Users/idajensen/Documents/umnbootcamp/Project-Longshot'...
[info]
[debug] [2018-01-21T01:44:03.167Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/longshotauth

Sat Jan 20 2018 19:44:03 GMT-0600 (CST)
[debug] [2018-01-21T01:44:03.534Z] <<< HTTP RESPONSE 200
[debug] [2018-01-21T01:44:03.535Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/783961136211/clients/_:getWebAppConfig

Sat Jan 20 2018 19:44:03 GMT-0600 (CST)
[debug] [2018-01-21T01:44:04.912Z] <<< HTTP RESPONSE 200
[info] i hosting: Serving hosting files from: public
[info] ✔ hosting: Local server: http://localhost:5000

[debug] [2018-01-21T01:45:51.609Z] ----------------------------------------------------------------------
[debug] [2018-01-21T01:45:51.611Z] Command: /usr/local/Cellar/node/8.5.0/bin/node /usr/local/bin/firebase serve
[debug] [2018-01-21T01:45:51.611Z] CLI Version: 3.17.3
[debug] [2018-01-21T01:45:51.611Z] Platform: darwin
[debug] [2018-01-21T01:45:51.611Z] Node Version: v8.5.0
[debug] [2018-01-21T01:45:51.612Z] Time: Sat Jan 20 2018 19:45:51 GMT-0600 (CST)
[debug] [2018-01-21T01:45:51.612Z] ----------------------------------------------------------------------
[debug]
[debug] [2018-01-21T01:45:51.622Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2018-01-21T01:45:51.622Z] > authorizing via signed-in user
[debug] [2018-01-21T01:45:51.624Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/longshotauth

Sat Jan 20 2018 19:45:51 GMT-0600 (CST)
[debug] [2018-01-21T01:45:53.355Z] <<< HTTP RESPONSE 200
[debug] [2018-01-21T01:45:53.356Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/longshotauth/tokens

Sat Jan 20 2018 19:45:53 GMT-0600 (CST)
[debug] [2018-01-21T01:45:53.627Z] <<< HTTP RESPONSE 200
[info]
[info] === Serving from '/Users/idajensen/Documents/umnbootcamp/Project-Longshot'...
[info]
[debug] [2018-01-21T01:45:53.630Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/longshotauth

Sat Jan 20 2018 19:45:53 GMT-0600 (CST)
[debug] [2018-01-21T01:45:53.984Z] <<< HTTP RESPONSE 200
[debug] [2018-01-21T01:45:53.984Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/783961136211/clients/_:getWebAppConfig

Sat Jan 20 2018 19:45:53 GMT-0600 (CST)
[debug] [2018-01-21T01:45:54.292Z] <<< HTTP RESPONSE 200
[info] i hosting: Serving hosting files from: public
[info] ✔ hosting: Local server: http://localhost:5000

[debug] [2018-01-21T03:18:11.322Z] ----------------------------------------------------------------------
[debug] [2018-01-21T03:18:11.329Z] Command: /usr/local/Cellar/node/8.5.0/bin/node /usr/local/bin/firebase serve
[debug] [2018-01-21T03:18:11.329Z] CLI Version: 3.17.3
[debug] [2018-01-21T03:18:11.329Z] Platform: darwin
[debug] [2018-01-21T03:18:11.329Z] Node Version: v8.5.0
[debug] [2018-01-21T03:18:11.330Z] Time: Sat Jan 20 2018 21:18:11 GMT-0600 (CST)
[debug] [2018-01-21T03:18:11.330Z] ----------------------------------------------------------------------
[debug]
[debug] [2018-01-21T03:18:11.339Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2018-01-21T03:18:11.339Z] > authorizing via signed-in user
[debug] [2018-01-21T03:18:11.341Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2018-01-21T03:18:11.341Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
{ refresh_token: '1/8xsTvQfVvHXSipMTAJzSy5uhqtUWBrPoQXaMsT79kRw',
client_id: '563584335869-fgrhgmd47bqnekij5i8b5pr03ho849e6.apps.googleusercontent.com',
client_secret: 'j9iVZfS8kkCEFUPaAeJV0sAi',
grant_type: 'refresh_token',
scope: 'email https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/firebase openid' }
Sat Jan 20 2018 21:18:11 GMT-0600 (CST)
[debug] [2018-01-21T03:18:15.375Z] <<< HTTP RESPONSE 200
[debug] [2018-01-21T03:18:15.390Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/longshotauth

Sat Jan 20 2018 21:18:15 GMT-0600 (CST)
[debug] [2018-01-21T03:18:15.792Z] <<< HTTP RESPONSE 200
[debug] [2018-01-21T03:18:15.793Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/longshotauth/tokens

Sat Jan 20 2018 21:18:15 GMT-0600 (CST)
[debug] [2018-01-21T03:18:16.280Z] <<< HTTP RESPONSE 200
[info]
[info] === Serving from '/Users/idajensen/Documents/umnbootcamp/Project-Longshot'...
[info]
[debug] [2018-01-21T03:18:16.283Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/longshotauth

Sat Jan 20 2018 21:18:16 GMT-0600 (CST)
[debug] [2018-01-21T03:18:16.808Z] <<< HTTP RESPONSE 200
[debug] [2018-01-21T03:18:16.809Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/783961136211/clients/_:getWebAppConfig

Sat Jan 20 2018 21:18:16 GMT-0600 (CST)
[debug] [2018-01-21T03:18:18.232Z] <<< HTTP RESPONSE 200
[info] i hosting: Serving hosting files from: public
[info] ✔ hosting: Local server: http://localhost:5000

[debug] [2018-01-21T03:31:53.995Z] ----------------------------------------------------------------------
[debug] [2018-01-21T03:31:53.996Z] Command: /usr/local/Cellar/node/8.5.0/bin/node /usr/local/bin/firebase init
[debug] [2018-01-21T03:31:53.997Z] CLI Version: 3.17.3
[debug] [2018-01-21T03:31:53.997Z] Platform: darwin
[debug] [2018-01-21T03:31:53.997Z] Node Version: v8.5.0
[debug] [2018-01-21T03:31:53.997Z] Time: Sat Jan 20 2018 21:31:53 GMT-0600 (CST)
[debug] [2018-01-21T03:31:53.997Z] ----------------------------------------------------------------------
[debug]
[debug] [2018-01-21T03:31:54.006Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"]
[debug] [2018-01-21T03:31:54.006Z] > authorizing via signed-in user
[info]
🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥 🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥
🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥
🔥🔥🔥🔥🔥🔥 🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥
🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥 🔥🔥
🔥🔥 🔥🔥🔥🔥 🔥🔥 🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥 🔥🔥 🔥🔥 🔥🔥🔥🔥🔥🔥 🔥🔥🔥🔥🔥🔥🔥🔥

You're about to initialize a Firebase project in this directory:

/Users/idajensen/Documents/umnbootcamp/Project-Longshot

Before we get started, keep in mind:

* You are initializing in an existing Firebase project directory

[debug] [2018-01-21T03:33:54.418Z] ----------------------------------------------------------------------
[debug] [2018-01-21T03:33:54.420Z] Command: /usr/local/Cellar/node/8.5.0/bin/node /usr/local/bin/firebase serve
[debug] [2018-01-21T03:33:54.420Z] CLI Version: 3.17.3
[debug] [2018-01-21T03:33:54.420Z] Platform: darwin
[debug] [2018-01-21T03:33:54.420Z] Node Version: v8.5.0
[debug] [2018-01-21T03:33:54.421Z] Time: Sat Jan 20 2018 21:33:54 GMT-0600 (CST)
[debug] [2018-01-21T03:33:54.421Z] ----------------------------------------------------------------------
[debug]
[debug] [2018-01-21T03:33:54.430Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2018-01-21T03:33:54.430Z] > authorizing via signed-in user
[debug] [2018-01-21T03:33:54.432Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/longshotauth

Sat Jan 20 2018 21:33:54 GMT-0600 (CST)
[debug] [2018-01-21T03:33:58.688Z] <<< HTTP RESPONSE 200
[debug] [2018-01-21T03:33:58.689Z] >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/longshotauth/tokens

Sat Jan 20 2018 21:33:58 GMT-0600 (CST)
[debug] [2018-01-21T03:33:59.017Z] <<< HTTP RESPONSE 200
[info]
[info] === Serving from '/Users/idajensen/Documents/umnbootcamp/Project-Longshot'...
[info]
[debug] [2018-01-21T03:33:59.020Z] >>> HTTP REQUEST GET https://cloudresourcemanager.googleapis.com/v1/projects/longshotauth

Sat Jan 20 2018 21:33:59 GMT-0600 (CST)
[debug] [2018-01-21T03:33:59.282Z] <<< HTTP RESPONSE 200
[debug] [2018-01-21T03:33:59.282Z] >>> HTTP REQUEST GET https://mobilesdk-pa.googleapis.com/v1/projects/783961136211/clients/_:getWebAppConfig

Sat Jan 20 2018 21:33:59 GMT-0600 (CST)
[debug] [2018-01-21T03:33:59.718Z] <<< HTTP RESPONSE 200
[info] i hosting: Serving hosting files from: public
[info] ✔ hosting: Local server: http://localhost:5000

19 changes: 19 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
94 changes: 70 additions & 24 deletions assets/javascript/app.js → public/assets/javascript/app.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
// Initialize Firebase
var config = {
apiKey: "AIzaSyCC1t5np8kPEV2yC0heaC4z0l6JtYNEMhY",
authDomain: "projectlongshot-469ee.firebaseapp.com",
databaseURL: "https://projectlongshot-469ee.firebaseio.com",
projectId: "projectlongshot-469ee",
storageBucket: "",
messagingSenderId: "333236357647"
apiKey: "AIzaSyCOVL51USj4HE7VfyPOI21R3uZT8yTa10c",
authDomain: "longshotauth.firebaseapp.com",
databaseURL: "https://longshotauth.firebaseio.com",
projectId: "longshotauth",
storageBucket: "",
messagingSenderId: "783961136211"
};

firebase.initializeApp(config);
database = firebase.database();
// var defaultAuth = firebase.auth();


var queryURLbase = "https://api.edamam.com/search?&app_id=4a5d81a2&app_key=379308ab9da9a8ee47f63563d2774ac4&from=0&to9&q=";
var userInput;
Expand All @@ -19,12 +21,10 @@ var label;
var recipe;
var sourceLink;

function testAjax(queryURL) {
$.ajax({
url: queryURL,
method: 'GET'
}).done(function(data) {
console.log(data);
function testAjax(queryURL){
fetch(queryURL)
.then((resp) => resp.json())
.then(function(data){
// console.log(queryURL);
for(var i = 0; i < 9; i++){

Expand Down Expand Up @@ -133,7 +133,7 @@ function testAjax(queryURL) {
})
};
});
};
}

$("#submit").on("click",function(e){
e.preventDefault();
Expand All @@ -148,12 +148,58 @@ $("#submit").on("click",function(e){
testAjax(searchURL);

});
//
//
//function to detect auth state change
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
alert("user signed in");
// User is signed in.
$("#logout-btn").show();
$("#login-btn").hide();
$("#signup-btn").hide();
var user = firebase.auth().currentUser;

if (user != null){
var email_id =user.email;
$("#member-info").text(email_id);
}
} else {
// No user is signed in.
$("#logout-btn").hide();
$("#login-btn").show();
$("#signup-btn").show();
}
});
//click event for sign up
function signUp(){
var userEmail = $("#email-input").val().trim();
var userPass = $("#password-input").val().trim();
firebase.auth().createUserWithEmailAndPassword(userEmail, userPass).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// ...
window.alert("Error : " + errorMessage);
});
}
//click event for logOut
function logOut(){
firebase.auth().signOut();
}
// Click event for sign in.
function login(){
var userEmail = $("#email-input").val().trim();
var userPass = $("#password-input").val().trim();
firebase.auth().signInWithEmailAndPassword(userEmail, userPass).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// ...
window.alert("Error : " + errorMessage);

//Click event for sign in.
$("#authentication-btn").on("click", function() {
console.log("Sign in button clicked");
});
}

//Trigger bottom sheet to open recipe box.
$(document).ready(function(){
Expand Down Expand Up @@ -214,20 +260,20 @@ $(document).on("click",".remove",function(e) {
return database.ref().update(updates);
};
})
//});
});

// If user decides that they don't want to remove the recipe from the recipe box...
$('#no-remove').on("click", function(){
return;
});

//If user decides that they don't want to remove the recipe from the recipe box...
//$('#no-remove').on("click", function(){
//return;
//});
});

//When Help link in the Footer is clicked, open help page.
// When Help link in the Footer is clicked, open help page.
$("#help-link").on("click", function(){
$("#help-modal").modal('open');
})

//When About link in the Footer is clicked, open about page.
$("#about-link").on("click", function(){
$("#about-modal").modal('open');
})
});
File renamed without changes.
Loading