Skip to content

Instantly share code, notes, and snippets.

@Jarmahent
Created June 7, 2019 17:52
Show Gist options
  • Save Jarmahent/57addfcc1bae6199f0162d32f6db1bf7 to your computer and use it in GitHub Desktop.
Save Jarmahent/57addfcc1bae6199f0162d32f6db1bf7 to your computer and use it in GitHub Desktop.
<script>
import { db, page_data, admin_user } from "./firebase";
export default {
name: "App",
firebase: {
data: {
source: page_data,
readyCallback: function() {
this.loaded = true;
}
}
},
created() {
page_data.once("value").then(data => {
this.code = JSON.stringify(data.val().content, null, 2);
});
},
methods: {
saveData: function() {
page_data.set({content: JSON.parse(this.code)});
this.showCodeEditor = false;
},
cancel: function(){
this.showAuth = false;
this.showCodeEditor = false;
},
showLogIn: function(){
this.showAuth = !this.showAuth;
}
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment