check session in lib/ajax if we're going to do more than just reading the newsfeed
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -4,6 +4,17 @@ import 'bootstrap';
|
||||
// load jquery
|
||||
window.$ = window.jQuery = require('jquery');
|
||||
|
||||
function getUrlVars() {
|
||||
var vars = [], hash;
|
||||
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||||
for (var i = 0; i < hashes.length; i++) {
|
||||
hash = hashes[i].split('=');
|
||||
vars.push(hash[0]);
|
||||
vars[hash[0]] = hash[1];
|
||||
}
|
||||
return vars;
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
const mytheme = 'Froxlor';
|
||||
@@ -15,14 +26,15 @@ $(document).ready(function () {
|
||||
if (typeof $("#newsfeed").data("role") !== "undefined") {
|
||||
role = "&role=" + $("#newsfeed").data("role");
|
||||
}
|
||||
var s = getUrlVars()["s"];
|
||||
|
||||
$.ajax({
|
||||
url : "lib/ajax.php?action=newsfeed" + role + "&theme=" + mytheme,
|
||||
type : "GET",
|
||||
success : function(data) {
|
||||
url: "lib/ajax.php?action=newsfeed" + role + "&theme=" + mytheme + "&s=" + s,
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
$("#newsfeeditems").html(data);
|
||||
},
|
||||
error : function(a, b) {
|
||||
error: function (a, b) {
|
||||
$("#newsfeeditems").html('<div class="alert alert-warning" role="alert">Error loading newsfeed</div>');
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user