-
-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store metadata about user and Gist #57
Conversation
src/views/EditorPage.vue
Outdated
@@ -119,6 +119,8 @@ export default { | |||
} | |||
}, | |||
mounted() { | |||
this.$store.dispatch('setUser') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is the right place to fetch user details, any better place for this @egoist?
src/store/index.js
Outdated
commit('SET_GIST_META', data) | ||
}, | ||
async setUser({ commit, state }) { | ||
const data = await api('user', state.githubToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems we don't need to setUser when there's no token
src/views/EditorPage.vue
Outdated
@@ -119,6 +119,8 @@ export default { | |||
} | |||
}, | |||
mounted() { | |||
this.$store.dispatch('setUser') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we don't need to call setUser when app is mounted, just save the user meta to localStorage after login?
Store the complete API response for Gist and user calls, so we can later access things like logged in username, Gist owner, and many more.
This will allow for things like:
and so on
This PR also pulls out the logic for GH API calls into a util module