Skip to content
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

Merged
merged 3 commits into from
Jan 30, 2018
Merged

Store metadata about user and Gist #57

merged 3 commits into from
Jan 30, 2018

Conversation

jgierer12
Copy link
Contributor

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

@@ -119,6 +119,8 @@ export default {
}
},
mounted() {
this.$store.dispatch('setUser')
Copy link
Contributor Author

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?

commit('SET_GIST_META', data)
},
async setUser({ commit, state }) {
const data = await api('user', state.githubToken)
Copy link
Owner

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

@@ -119,6 +119,8 @@ export default {
}
},
mounted() {
this.$store.dispatch('setUser')
Copy link
Owner

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?

@egoist egoist merged commit c943c1b into egoist:master Jan 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants