<commit_before>import Vue from 'vue';
import Vuex from 'vuex';
import axios from 'axios';

import baseurl from 'baseurl.js'

axios.defaults.baseURL = baseurl;
axios.defaults.headers.common.Accept = 'application/json';
axios.defaults.timeout = 15000; // 15 seconds

Vue.use(Vuex);

const store = new Vuex.Store({
  state: {
    drawer: null,
    currentUser: null,
    session_id: null,
    token: localStorage.getItem('token') || null,
    alerts: [
      // { type: 'info', message: 'Info' },
      // { type: 'success', message: 'Success' },
      // { type: 'warning', message: 'Warning' },
      // { type: 'error', message: 'Error' },
    ],
  },

  getters: {
    isAuthenticated(state) {
      return state.token;
    },

    getDrawer(state) {
      return state.drawer;
    },

    getAlerts(state) {
      return state.alerts;
    },
  },

  mutations: {
    signInUser(state, payload) {
      let token = payload.data.token;
      state.token = token;
      localStorage.setItem('token', token);
    },

    signInUserWithToken(state, token) {
      state.token = token;
      localStorage.setItem('token', token);
    },

    signOutUser(state) {
      state.token = null;
      localStorage.removeItem('token');
      state.alerts = [];
    },

    setAlert(state, alert) {
      state.alerts.push(alert);
    },

    clearAlerts(state) {
      state.alerts = [];
    },

    setDrawer(state, option) {
      state.drawer = option;
    },
  },

  actions: {
    async signUp({ commit, state }, payload) {
      try {
        const response = await axios.post('/api/sign_up', payload);

        commit('signInUser', response);

        return response;
      } catch (error) {
        return error;
      }
    },

    async signIn({ commit, state }, payload) {
      try {
        const response = await axios.post('/api/sign_in', payload);

        commit('signInUser', response);

        return response;
      } catch (error) {
        return error;
      }
    },

    async signOut({ commit, state }) {
      try {
        await axios.delete('/api/sign_out');
      } finally {
        commit('signOutUser');
      }
    },

    async forgotPassword({ commit, state }, payload) {
      try {
        return await axios.get('/api/forgot_password', payload);
      } catch (error) {
        return error;
      }
    },

    async fetchProfile({ commit, state }) {
      try {<commit_msg>Add changePassword to store<commit_after>import Vue from 'vue';
import Vuex from 'vuex';
import axios from 'axios';

import baseurl from 'baseurl.js'

axios.defaults.baseURL = baseurl;
axios.defaults.headers.common.Accept = 'application/json';
axios.defaults.timeout = 15000; // 15 seconds

Vue.use(Vuex);

const store = new Vuex.Store({
  state: {
    drawer: null,
    currentUser: null,
    session_id: null,
    token: localStorage.getItem('token') || null,
    alerts: [
      // { type: 'info', message: 'Info' },
      // { type: 'success', message: 'Success' },
      // { type: 'warning', message: 'Warning' },
      // { type: 'error', message: 'Error' },
    ],
  },

  getters: {
    isAuthenticated(state) {
      return state.token;
    },

    getDrawer(state) {
      return state.drawer;
    },

    getAlerts(state) {
      return state.alerts;
    },
  },

  mutations: {
    signInUser(state, payload) {
      let token = payload.data.token;
      state.token = token;
      localStorage.setItem('token', token);
    },

    signInUserWithToken(state, token) {
      state.token = token;
      localStorage.setItem('token', token);
    },

    signOutUser(state) {
      state.token = null;
      localStorage.removeItem('token');
      state.alerts = [];
    },

    setAlert(state, alert) {
      state.alerts.push(alert);
    },

    clearAlerts(state) {
      state.alerts = [];
    },

    setDrawer(state, option) {
      state.drawer = option;
    },
  },

  actions: {
    async signUp({ commit, state }, payload) {
      try {
        const response = await axios.post('/api/sign_up', payload);

        commit('signInUser', response);

        return response;
      } catch (error) {
        return error;
      }
    },

    async signIn({ commit, state }, payload) {
      try {
        const response = await axios.post('/api/sign_in', payload);

        commit('signInUser', response);

        return response;
      } catch (error) {
        return error;
      }
    },

    async signOut({ commit, state }) {
      try {
        await axios.delete('/api/sign_out');
      } finally {
        commit('signOutUser');
      }
    },

    async changePassword({ commit, state }, payload) {
      try {
        return await axios.post('/api/change_password', payload);
      } catch (error) {
        return error;
      }
    },

    async forgotPassword({ commit, state }, payload) {
      try {
        return await axios.get('/api/forgot_password', payload);
      } catch (error) {
        return error;
      }
    },

    async fetchProfile({ commit, state }) {
      try {
{'fraction_non_alphanumeric': 0.1452480573819486, 'fraction_numerical': 0.002789400278940028, 'mean_word_length': 2.1954169318905157, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1644590', 'n_tokens_mistral': 1609, 'n_tokens_neox': 1565, 'n_words': 343}