Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

registration.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import axios from 'axios'
  2. import {
  3. sha256
  4. } from 'js-sha256'
  5. export default {
  6. namespaced: true,
  7. state: {
  8. userContainer: {},
  9. restaurantContainer: {}
  10. },
  11. mutations: {
  12. addUserContainer(state, userContainer) {
  13. state.userContainer = userContainer
  14. },
  15. addRestaurantContainer(state, restaurantContainer) {
  16. state.restaurantContainer = restaurantContainer;
  17. },
  18. },
  19. getters: {},
  20. actions: {
  21. getUserContainer({
  22. commit
  23. }) {
  24. axios
  25. .get('/api/registration/GetUserContainer')
  26. .then((result) => commit('addUserContainer', result.data))
  27. .catch(console.error)
  28. },
  29. regUser({
  30. commit
  31. }, user) {
  32. user.password = sha256(user.password + '≡∆≤≥√∞ProVision')
  33. axios
  34. .post('/api/registration/resgisterUser', user)
  35. .then((result) => commit('addUserContainer', result.data))
  36. .catch(console.error)
  37. },
  38. getRestaurantContainer({
  39. commit
  40. }) {
  41. axios
  42. .get('/api/registration/GetRestaurantContainer')
  43. .then((result) => commit('addRestaurantContainer', result.data))
  44. .catch(console.error)
  45. },
  46. regRestaurant({
  47. commit
  48. }, restaurant) {
  49. restaurant.userPassword = sha256(restaurant.userPassword + '≡∆≤≥√∞ProVision')
  50. axios
  51. .post('/api/registration/resgisterRestaurant', restaurant)
  52. .then((result) => commit('addRestaurantContainer', result.data))
  53. .catch(console.error)
  54. }
  55. }
  56. }