Guest User

Untitled

a guest
Oct 23rd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 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. }) console.log(changeempdatas)
  10. return changeempdatas;
  11. }
  12. }
  13. });
  14.  
  15. conn= pymysql.connect
  16. (host='127.0.0.1',user='root',password='',
  17. db='test')
  18. class senddata(Resource):
  19. def post(self):
  20. curr = conn.cursor()
  21. getdataqry = curr.execute("SELECT *
  22. FROM `employee`")
  23. getdatas = curr.fetchall()
  24. #empdata = []
  25. print "Post"
  26. i=0
  27. empdata = {}
  28. for getdata in getdatas:
  29. i += 1
  30. empdata[i] = {}
  31. empdata[i]['id'] = getdata[0]
  32. empdata[i]['name'] = getdata[1]
  33. #empdata.append({'id': getdata[0],
  34. 'name': getdata[1]})
  35.  
  36. return jsonify({'empdata': empdata})
  37. a.close()
Add Comment
Please, Sign In to add comment