diff --git a/.gitignore b/.gitignore
index bdd0bbe..0586dba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,5 @@ assets/static/custom\.css
config\.json
vendor/
+
+assets/config/users\.db
diff --git a/assets/config/users.db b/assets/config/users.db
index 05beb0c..91ef3eb 100644
Binary files a/assets/config/users.db and b/assets/config/users.db differ
diff --git a/assets/web/static/app.js b/assets/web/static/app.js
index 7427f35..68d79d7 100644
--- a/assets/web/static/app.js
+++ b/assets/web/static/app.js
@@ -1,9 +1,37 @@
const episodepublishform = {
- template: '
Publish Episode
'
+ template: `
+
Publish Episode
+
+`
}
-const episodemanagement = {
- template: 'Title | URL | Actions |
---|
{{ item.id }}: {{ item.title }} | {{ item.url }} | Edit |
',
+const usermanagement = {
+ template: `
+
+
+ Title |
+ URL |
+ Actions |
+
+
+ {{ item.id }}: {{ item.title }} |
+ {{ item.url }} |
+
+ Edit
+ |
+
+
+
`,
data() {
return {
loading: false,
@@ -25,7 +53,7 @@ const episodemanagement = {
this.error = this.items = []
this.loading = true
- getEpisodes((err, items) => {
+ get("/admin/listusers", (err, items) => {
this.loading = false
if (err) {
this.error = err.toString()
@@ -45,8 +73,72 @@ const episodemanagement = {
}
}
+const episodemanagement = {
+ template: `
+
+
+ Title | URL | Actions |
+
+
+ {{ item.id }}: {{ item.title }} | {{ item.url }} | Edit |
+
+
+
`,
+ data() {
+ return {
+ loading: false,
+ items: null,
+ error: null
+ }
+ },
+ created() {
+ // fetch the data when the view is created and the data is
+ // already being observed
+ this.fetchData()
+ },
+ watch: {
+ // call again the method if the route changes
+ '$route': 'fetchData'
+ },
+ methods: {
+ fetchData() {
+ this.error = this.items = []
+ this.loading = true
+
+ get("/json", (err, items) => {
+ this.loading = false
+ if (err) {
+ this.error = err.toString()
+ } else {
+ var t = JSON.parse(items).items
+ for (var i = t.length - 1; i >= 0; i--) {
+ this.items.push({
+ title: t[i].title,
+ url: t[i].url,
+ id: t[i].id
+ })
+ }
+ }
+ })
+ }
+ }
+}
+
const episodeedit = {
- template: '',
+ template: ``,
data() {
return {
loading: false,
@@ -68,7 +160,7 @@ const episodeedit = {
this.error = this.episode = {}
this.loading = true
- getEpisodes((err, items) => {
+ get("/json", (err, items) => {
this.loading = false
if (err) {
this.error = err.toString()
@@ -96,7 +188,15 @@ const episodeedit = {
}
const customcss = {
- template: 'Edit CSS
',
+ template: `
+
Edit CSS
+
+`,
data() {
return {
loading: false,
@@ -118,7 +218,7 @@ const customcss = {
this.error = this.css = null
this.loading = true
- getCss((err, css) => {
+ get("/admin/css", (err, css) => {
this.loading = false
if (err) {
this.error = err.toString()
@@ -148,22 +248,12 @@ const app = new Vue({
}
}).$mount('#app')
-function getCss(callback) {
+function get(url,callback) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
callback(null, xmlHttp.responseText)
}
- xmlHttp.open("GET", "/admin/css", true);
- xmlHttp.send(null);
-}
-
-function getEpisodes(callback) {
- var xmlHttp = new XMLHttpRequest();
- xmlHttp.onreadystatechange = function() {
- if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
- callback(null, xmlHttp.responseText)
- }
- xmlHttp.open("GET", "/json", true);
+ xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}
\ No newline at end of file