/* eslint-disable */
import axios from "axios";

export default {
  namespaced: true,
  state: {
    terms: []
  },
  mutations: {
    getTermsAndConditions: (state, fee) => (state.terms = fee),
    newTermsAndConditions: (state, fee) => (state.terms = fee)
  },
  getters: {
    getTermsAndConditions: state => state.terms
  },
  actions: {
    async retrieveTerms({ commit }) {
      await axios.get("api/tc/").then(res => {
        commit("getTermsAndConditions", res.data);
      });
    },
    async setTerms({ commit }, terms) {
      await axios.post("api/tc/", terms)
      .then((resp) => {
        commit("newTermsAndConditions", resp.data);
        return Promise.resolve();
      })
      .catch((ex) => {
        return Promise.reject(ex.response);
      })
      
    }
  }
};
