123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import axios from 'axios'
- import {
- sha256
- } from 'js-sha256'
-
- export default {
- namespaced: true,
- state: {
- userContainer: {},
- restaurantContainer: {}
- },
- mutations: {
- addUserContainer(state, userContainer) {
- state.userContainer = userContainer
- },
- addRestaurantContainer(state, restaurantContainer) {
- state.restaurantContainer = restaurantContainer;
- },
- },
- getters: {},
- actions: {
- getUserContainer({
- commit
- }) {
- axios
- .get('/api/registration/GetUserContainer')
- .then((result) => commit('addUserContainer', result.data))
- .catch(console.error)
- },
- regUser({
- commit
- }, user) {
- user.password = sha256(user.password + '≡∆≤≥√∞ProVision')
- axios
- .post('/api/registration/resgisterUser', user)
- .then((result) => commit('addUserContainer', result.data))
- .catch(console.error)
- },
- getRestaurantContainer({
- commit
- }) {
- axios
- .get('/api/registration/GetRestaurantContainer')
- .then((result) => commit('addRestaurantContainer', result.data))
- .catch(console.error)
- },
- regRestaurant({
- commit
- }, restaurant) {
- restaurant.userPassword = sha256(restaurant.userPassword + '≡∆≤≥√∞ProVision')
- axios
- .post('/api/registration/resgisterRestaurant', restaurant)
- .then((result) => commit('addRestaurantContainer', result.data))
- .catch(console.error)
- }
- }
- }
|