mirror of
https://github.com/gmemstr/pogo.git
synced 2024-09-20 01:31:09 +01:00
Better handling of permissions in frontend
This commit is contained in:
parent
f3c011510d
commit
4351bb7e4e
|
@ -205,6 +205,7 @@ const episodemanagement = {
|
||||||
} else {
|
} else {
|
||||||
var t = JSON.parse(items).items
|
var t = JSON.parse(items).items
|
||||||
for (var i = t.length - 1; i >= 0; i--) {
|
for (var i = t.length - 1; i >= 0; i--) {
|
||||||
|
console.log(i)
|
||||||
this.items.push({
|
this.items.push({
|
||||||
title: t[i].title,
|
title: t[i].title,
|
||||||
url: t[i].url,
|
url: t[i].url,
|
||||||
|
@ -312,11 +313,15 @@ const customcss = {
|
||||||
|
|
||||||
get("/admin/css", (err, css) => {
|
get("/admin/css", (err, css) => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
if (css == "{}") {
|
||||||
|
this.css = "You aren't allowed to edit this CSS!"
|
||||||
|
} else {
|
||||||
if (err) {
|
if (err) {
|
||||||
this.error = err.toString()
|
this.error = err.toString()
|
||||||
} else {
|
} else {
|
||||||
this.css = css
|
this.css = css
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -348,9 +353,14 @@ const app = new Vue({
|
||||||
function get(url,callback) {
|
function get(url,callback) {
|
||||||
var xmlHttp = new XMLHttpRequest();
|
var xmlHttp = new XMLHttpRequest();
|
||||||
xmlHttp.onreadystatechange = function() {
|
xmlHttp.onreadystatechange = function() {
|
||||||
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
|
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
|
||||||
|
if (xmlHttp.responseText == "Unauthorized") {
|
||||||
|
callback(null, "{}")
|
||||||
|
} else {
|
||||||
callback(null, xmlHttp.responseText)
|
callback(null, xmlHttp.responseText)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
xmlHttp.open("GET", url, true);
|
xmlHttp.open("GET", url, true);
|
||||||
xmlHttp.send(null);
|
xmlHttp.send(null);
|
||||||
}
|
}
|
Loading…
Reference in a new issue