Guest User

Untitled

a guest
Oct 23rd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. export const store = new Vuex.Store({
  2. state: {},
  3. getters: {
  4. changeempdatas: (state) => {
  5. var apidata =Vue.axios.post ('http://127.0.0.1:5000/').then( (response) => {return response.data});
  6. var changeempdatas = apidata.then(function(result) {
  7. console.log(result.empdata)
  8. return result.empdata;
  9. })
  10. console.log(changeempdatas)
  11. return changeempdatas;
  12. }
  13. }
  14. });
  15.  
  16. conn= pymysql.connect
  17. (host='127.0.0.1',user='root',password='',
  18. db='test')
  19. class senddata(Resource):
  20. def post(self):
  21. curr = conn.cursor()
  22. getdataqry = curr.execute("SELECT *
  23. FROM `employee`")
  24. getdatas = curr.fetchall()
  25. #empdata = []
  26. print "Post"
  27. i=0
  28. empdata = {}
  29. for getdata in getdatas:
  30. i += 1
  31. empdata[i] = {}
  32. empdata[i]['id'] = getdata[0]
  33. empdata[i]['name'] = getdata[1]
  34. #empdata.append({'id': getdata[0],
  35. 'name': getdata[1]})
  36.  
  37. return jsonify({'empdata': empdata})
  38. a.close()
Add Comment
Please, Sign In to add comment