diff --git a/package.json b/package.json
index cb07710..a327b9b 100644
--- a/package.json
+++ b/package.json
@@ -8,6 +8,7 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
+ "micropub-helper": "^1.4.0",
"node-sass": "^4.9.3",
"vue": "^2.5.17",
"vue-router": "^3.0.1",
diff --git a/src/components/LoginModal.vue b/src/components/LoginModal.vue
index 53f698f..f41b8c9 100644
--- a/src/components/LoginModal.vue
+++ b/src/components/LoginModal.vue
@@ -23,9 +23,11 @@
-
diff --git a/src/helpers.js b/src/helpers.js
new file mode 100644
index 0000000..7d7b7af
--- /dev/null
+++ b/src/helpers.js
@@ -0,0 +1,12 @@
+function statePart() {
+ return Math.random().toString(36).substring(7)
+}
+
+function generateState() {
+ return statePart() + statePart() + statePart() + statePart();
+}
+
+
+export default {
+ generateState
+}
diff --git a/src/store.js b/src/store.js
index c1d871f..c6269b6 100644
--- a/src/store.js
+++ b/src/store.js
@@ -7,17 +7,24 @@ Vue.use(Vuex)
export default new Vuex.Store({
state() {
- let loginData = JSON.parse(window.localStorage.getItem('login_data'))
let newState = {
channels: [],
timeline: {items: [], paging: {}},
channel: {},
debug: false,
+ logged_in: false,
+ micropubEndpoint: '',
+ microsubEndpoint: ''
};
+ let loginData = JSON.parse(window.localStorage.getItem('login_data'))
if (loginData) {
newState = { ...newState, ...loginData }
newState.logged_in = loginData.access_token && loginData.access_token.length > 0
}
+ let endpoints = JSON.parse(window.localStorage.getItem('endpoints'))
+ if (endpoints) {
+ newState = { ...newState, ...endpoints}
+ }
return newState
},
@@ -77,6 +84,10 @@ export default new Vuex.Store({
commit('newTimeline', {channel: channel, timeline: response})
})
},
+ saveEndpoints({commit}, endpoints) {
+ window.localStorage.setItem('endpoints', JSON.stringify(endpoints))
+ commit('newEndpoints', endpoints)
+ },
tokenResponse({commit}, response) {
window.localStorage.setItem('login_data', JSON.stringify(response))
commit('newAccessToken', response)