Store edited page in DB

This commit is contained in:
Torsten 2020-01-30 11:51:41 +01:00
parent fb0f00c184
commit 5b06cba327
4 changed files with 235 additions and 234 deletions

View file

@ -1894,7 +1894,6 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
@ -1921,6 +1920,23 @@ __webpack_require__.r(__webpack_exports__);
//console.log(this.editor.docView.dom.innerHTML);
console.log(this.editor.view.docView.dom.innerHTML);
},
savePage: function savePage() {
var _this = this;
axios.post('http://localhost:8000/api/v1/auth/save_page', {
page: 'testpage',
body: this.editor.view.docView.dom.innerHTML
}, {
headers: {
'Authorization': 'Bearer ' + this.$store.state.user_token
}
}).then(function (res) {
console.log("savePage: Wrote Testpage");
console.log("Going back to main view");
_this.$router.push("/");
});
}
}
});
@ -1983,14 +1999,6 @@ __webpack_require__.r(__webpack_exports__);
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({
data: function data() {
return {
@ -2053,15 +2061,15 @@ __webpack_require__.r(__webpack_exports__);
},
created: function created() {
console.log("Main component created");
/*
if (!this.$store.state.user.token) {
console.log("No token on user detected. Waiting for user login.");
console.log("store.state.user:");
console.log(this.$store.state.user);
if (!this.$store.state.user_token) {
console.log("No token on user detected. Waiting for user login.");
console.log("store.state.user:");
console.log(this.$store.state.user);
} else {
this.$router.push("/main");
//this.$router.push("/main");
this.loadPage();
}
*/
}
});
@ -31065,7 +31073,22 @@ var render = function() {
])
}),
_vm._v(" "),
_c("editor-content", { attrs: { editor: _vm.editor } })
_c("editor-content", { attrs: { editor: _vm.editor } }),
_vm._v(" "),
_c("p", [
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.savePage()
}
}
},
[_vm._v("Speichern")]
)
])
],
1
)
@ -31098,197 +31121,160 @@ var render = function() {
_vm._v("Motorrad IG\n ")
]),
_vm._v(" "),
_c(
"div",
{ staticClass: "has-text-centered" },
[
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Über uns")
}
_c("div", { staticClass: "has-text-centered" }, [
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Über uns")
}
},
[_vm._v("Über uns")]
),
_vm._v(" "),
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Aktuelles")
}
}
},
[_vm._v("Über uns")]
),
_vm._v(" "),
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Aktuelles")
}
},
[_vm._v("Aktuelles")]
),
_vm._v(" "),
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Mitgliedsantrag")
}
}
},
[_vm._v("Aktuelles")]
),
_vm._v(" "),
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Mitgliedsantrag")
}
},
[_vm._v("Mitgliedsantrag")]
),
_vm._v(" "),
!this.$store.state.user.hasOwnProperty("role")
? _c("span", [
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Tourplan")
}
}
},
[_vm._v("Mitgliedsantrag")]
),
_vm._v(" "),
!this.$store.state.user.hasOwnProperty("role")
? _c("span", [
_c(
"button",
{ staticClass: "button", on: { click: function($event) {} } },
[_vm._v("Tourplan (Beispiel)")]
)
])
: this.$store.state.user.role === "GUEST"
? _c("span", [
_c(
"button",
{ staticClass: "button", on: { click: function($event) {} } },
[_vm._v("Tourplan (Gast)")]
)
])
: this.$store.state.user.role === "MEMBER"
? _c("span", [
_c(
"button",
{ staticClass: "button", on: { click: function($event) {} } },
[_vm._v("Tourplan (komplett)")]
)
])
: this.$store.state.user.role === "ADMIN"
? _c("span", [
_c(
"button",
{ staticClass: "button", on: { click: function($event) {} } },
[_vm._v("Tourplan (komplett)")]
)
])
: _vm._e(),
_vm._v(" "),
this.$store.state.user.role === "ADMIN"
? _c("span", [
_c(
"button",
{ staticClass: "button", on: { click: function($event) {} } },
[_vm._v("Userverwaltung")]
)
])
: _vm._e(),
_vm._v(" "),
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Wetter")
}
}
},
[_vm._v("Wetter")]
),
_vm._v(" "),
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Links")
}
}
},
[_vm._v("Links")]
),
_vm._v(" "),
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Impressum")
}
}
},
[_vm._v("Impressum")]
),
_vm._v(" "),
this.$store.state.user.hasOwnProperty("role")
? _c("span", [
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.logout()
}
},
[_vm._v("Tourplan (Beispiel)")]
)
])
: this.$store.state.user.role === "GUEST"
? _c("span", [
}
},
[_vm._v("Logout")]
)
])
: _vm._e(),
_vm._v(" "),
!this.$store.state.user.hasOwnProperty("role")
? _c(
"span",
[
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Tourplan")
}
}
},
[_vm._v("Tourplan (Gast)")]
"router-link",
{ staticClass: "button", attrs: { to: { name: "Login" } } },
[_vm._v("Log-In")]
)
])
: this.$store.state.user.role === "MEMBER"
? _c("span", [
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Tourplan")
}
}
},
[_vm._v("Tourplan (komplett)")]
)
])
: this.$store.state.user.role === "ADMIN"
? _c("span", [
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Tourplan")
}
}
},
[_vm._v("Tourplan (komplett)")]
)
])
: _vm._e(),
_vm._v(" "),
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Wetter")
}
}
},
[_vm._v("Wetter")]
),
_vm._v(" "),
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Links")
}
}
},
[_vm._v("Links")]
),
_vm._v(" "),
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.changeMainText("Impressum")
}
}
},
[_vm._v("Impressum")]
),
_vm._v(" "),
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.savePage()
}
}
},
[_vm._v("Save Page")]
),
_vm._v(" "),
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.loadPage()
}
}
},
[_vm._v("Load Page")]
),
_vm._v(" "),
_c(
"button",
{
staticClass: "button",
on: {
click: function($event) {
return _vm.logout()
}
}
},
[_vm._v("Logout")]
),
_vm._v(" "),
_c(
"router-link",
{ staticClass: "button", attrs: { to: { name: "Login" } } },
[_vm._v("Log-In")]
)
],
1
),
],
1
)
: _vm._e()
]),
_vm._v(" "),
_c("p", [_vm._v(" ")]),
_vm._v(" "),
@ -31302,20 +31288,27 @@ var render = function() {
"p",
{ staticStyle: { "text-align": "center" }, attrs: { visible: "true" } },
[
_c("span", {
domProps: { innerHTML: _vm._s(this.$store.state.page_content) }
}),
_vm._v(" "),
this.$store.state.user.role === "ADMIN"
? _c("span", [
_c("br"),
_c(
"button",
{ staticClass: "button", on: { click: _vm.editPage } },
{
staticClass: "button",
on: {
click: function($event) {
return _vm.editPage()
}
}
},
[_vm._v("Text bearbeiten")]
)
])
: _vm._e(),
_vm._v(" "),
_c("span", {
domProps: { innerHTML: _vm._s(this.$store.state.page_content) }
})
: _vm._e()
]
)
])