Hi everyone,
I am really stuck on this one. I made the Nightlige Coordination App with the MEAN stack. Authentication is with Passport JS. When you do a search and you login, it refreshes the page and deletes the results and you have to do the same search again. Anyone can help me how to make it not refresh/reload after login???
My Passport Routes:
var passport = require('passport');
var FacebookStrategy = require('passport-facebook').Strategy;
var session = require('express-session');
passport.serializeUser(function(user, done) {
done(null, user);
});
passport.deserializeUser(function(id, done) {
done(null, id);
});
app.get('/auth/facebook', passport.authenticate('facebook'));
app.get('/auth/facebook/callback', passport.authenticate('facebook', {
successRedirect: '/',
failureRedirect: '/error'
}));
My Angular code:
angular.module("popperooApp", ['ngRoute'])
.config(function($routeProvider) {
$routeProvider
.when("/", {
templateUrl: "list.html",
controller: "ListController"
})
.otherwise({
redirectTo: "/"
});
})
.service("Venues", function($http) {
this.getVenues = function(location) {
var url = "search/" + location;
return $http.get(url);
};
})
.controller('ListController', function($scope, Venues) {
$scope.searchLocation = function(location) {
Venues.getVenues(location)
.then(function(response) {
$scope.venues = response.data;
}, function(response) {
alert("Error retrieving venues");
console.log(response);
});
};
})
I have tried several methods but none of it works for now.
Any help much appreciated?