diff --git a/src/components/ChannelCreator.vue b/src/components/ChannelCreator.vue
new file mode 100644
index 0000000..3c1bb09
--- /dev/null
+++ b/src/components/ChannelCreator.vue
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/Channels.vue b/src/components/Channels.vue
index eb0a242..dad3801 100644
--- a/src/components/Channels.vue
+++ b/src/components/Channels.vue
@@ -3,13 +3,21 @@
+
diff --git a/src/store.js b/src/store.js
index 13d4670..3cda683 100644
--- a/src/store.js
+++ b/src/store.js
@@ -13,7 +13,8 @@ export default new Vuex.Store({
debug: false,
logged_in: false,
micropubEndpoint: '',
- microsubEndpoint: ''
+ microsubEndpoint: '',
+ channelCreatorIsOpen: false
};
let loginData = JSON.parse(window.localStorage.getItem('login_data'))
if (loginData) {
@@ -47,6 +48,9 @@ export default new Vuex.Store({
items: [],
paging: {}
}
+ },
+ setChannelCreatorState(state, open) {
+ state.channelCreatorIsOpen = open
}
},
@@ -119,6 +123,23 @@ export default new Vuex.Store({
'like-of': [url]
}
})
+ },
+ openChannelCreator({commit}) {
+ commit('setChannelCreatorState', true)
+ },
+ closeChannelCreator({commit}) {
+ commit('setChannelCreatorState', false)
+ },
+ createChannel(x, name) {
+ let url = this.state.microsubEndpoint + '?action=channels&name=' + encodeURIComponent(name)
+ return fetch(url, {
+ method: 'POST',
+ headers: {
+ 'Authorization': 'Bearer ' + this.state.access_token
+ }
+ }).then(() => {
+ this.dispatch('fetchChannels')
+ })
}
}
})
diff --git a/src/views/Home.vue b/src/views/Home.vue
index 3c1d7fe..33b8353 100644
--- a/src/views/Home.vue
+++ b/src/views/Home.vue
@@ -8,6 +8,8 @@
+
+
@@ -16,13 +18,15 @@
import Timeline from '@/components/Timeline.vue'
import Channels from '@/components/Channels.vue'
import Channel from '@/components/Channel.vue'
+ import ChannelCreator from '@/components/ChannelCreator.vue'
export default {
name: 'home',
components: {
Timeline,
Channels,
- Channel
+ Channel,
+ ChannelCreator
},
computed: {