Created
May 23, 2018 13:56
-
-
Save bschulz87/f05fabe041909e99a28e788e8901159c to your computer and use it in GitHub Desktop.
Vuex API Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import api from '@/api' | |
const getArticle = ({commit}) => { | |
return new Promise((resolve, reject) => { | |
api.getArticle().then((result) => { | |
if (result) { | |
commit('UPDATE_ARTICLE', result) | |
resolve('Successfully got article') | |
} else { | |
reject(Error('Could not get article')) | |
} | |
}) | |
}) | |
} | |
export { | |
getArticle | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Parse from 'parse' | |
const Article = Parse.Object.extend('Article') | |
const getArticle = async () => { | |
const articleQuery = new Parse.Query(Article) | |
return await brandQuery.first().then((result) => { | |
return result | |
}) | |
} | |
export { | |
getArticle | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment