text: import $axios from '../api.js'
  
  const state = () => ({
      drivers: [], //STATE UNTUK MENAMPUNG DATA CUSTOMERS
      
      //STATE INI UNTUK FORM ADD DAN EDIT NANTINYA
      driver: {
          driver_name: '',
          driver_address: '',
          mobile_number:'',
          email:'',
          
      },
      page: 1
  })
  
  const mutations = {
      //MUTATIONS UNTUK ASSIGN DATA CUSTOMER KE DALAM STATE CUSTOMER
      ASSIGN_DATA(state, payload) {
          state.drivers = payload
      },
      //MENGUBAH STATE PAGE
      SET_PAGE(state, payload) {
          state.page = payload
      },
      //MENGUBAH STATE CUSTOMER
      ASSIGN_FORM(state, payload) {
          state.driver = payload
      },
      //RESET STATE CUSTOMER
      CLEAR_FORM(state) {
          state.driver = {
              driver_name: '',
              driver_address: '',
              
          }
      }
  }
  
  const actions = {
      getDrivers({ commit, state }, payload) {
          let search = typeof payload != 'undefined' ? payload:''
          return new Promise((resolve, reject) => {
              //REQUEST DATA CUSTOMER  DENGAN MENGIRIMKAN PARAMETER PAGE YG SEDANG AKTIF DAN VALUE PENCARIAN
              $axios.get(`/driver?page=${state.page}&q=${search}`)
              .then((response) => {
                  commit('ASSIGN_DATA', response.data) //JIKA DATA DITERIMA, SIMPAN DATA KEDALMA MUTATIONS
                  resolve(response.data)
              })
          })
      },
      getDriverForm({ commit, state }, payload) {
          let search = typeof payload != 'undefined' ? payload:''
          return new Promise((resolve, reject) => {
              //REQUEST DATA CUSTOMER  DENGAN MENGIRIMKAN PARAMETER PAGE YG SEDANG AKTIF DAN VALUE PENCARIAN
              $axios.get(`/driverform?page=${state.page}&q=${search}`)
              .then((response) => {
                  commit('ASSIGN_DATA', response.data) //JIKA DATA DITERIMA, SIMPAN DATA KEDALMA MUTATIONS
                  resolve(response.data)
              })
          })
      },
    
  }
  
  export default {
      namespaced: true,
      state,
      actions,
      mutations
  }