Commit 50dc7722 authored by Kittisak Maneewong's avatar Kittisak Maneewong

config default baseurl axios vue laravel

parent 51ab882a
This diff is collapsed.
......@@ -4,15 +4,7 @@ window._ = require('lodash');
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
let token = document.head.querySelector('meta[name="csrf-token"]');
if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
}
window.axios.defaults.baseUrl = 'http://localhost:8000/';
import Vue from 'vue';
import Vuetify from 'vuetify';
......@@ -24,8 +16,6 @@ import store from './store';
import 'iview/dist/styles/iview.css';
// Vue.config.productionTip = false;
Vue.use(Vuetify);
Vue.use(iView);
......
......@@ -57,7 +57,7 @@ export default new Vuex.Store({
login ({commit, dispatch}, payload) {
return new Promise((resolve, reject) => {
commit('setLoading', true)
axios.post('api/auth/login', payload)
axios.post('/api/auth/login', payload)
.then(res => {
commit('setLoading', false)
if (payload.role == 1) {
......@@ -100,7 +100,7 @@ export default new Vuex.Store({
register ({commit}, payload) {
return new Promise((resolve, reject) => {
commit('setLoading', true)
axios.post('api/auth/register', payload)
axios.post('/api/auth/register', payload)
.then(res => {
if (payload.role === 1) {
iView.LoadingBar.finish()
......
......@@ -4,7 +4,7 @@
<meta charset="utf-8">
<!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
<meta name="csrf-token" content="{{ csrf_token() }}">
<!-- <meta name="csrf-token" content="{{ csrf_token() }}"> -->
<title>CO-OP Search</title>
......
......@@ -12,9 +12,3 @@
*/
Route::get('/{any}', 'AppController@index')->where('any', '.*');
\ No newline at end of file
Route::group(['prefix' => 'employer/api/auth'], function ($router) {
Route::post('register', 'AuthController@register');
Route::post('login', 'AuthController@login');
Route::get('current', 'AuthController@getAuthenticatedUser');
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment