bitfumes / private-chat-app-with-laravel-vuejs-pusher

Create an Awesome one to one chat app with Laravel vuejs and pusher
31 stars 27 forks source link

auth is not defined #15

Closed asadullah097 closed 4 years ago

asadullah097 commented 4 years ago

I am using laravel 7 with vuejs it give me the error auth is not defined error

vipertecpro commented 3 years ago

HOW DID YOU RESOLVED THIS ????????????????????????????????????????

asadullah097 commented 3 years ago

use the below script in your master blade

use these on the view/js/bootsrap.js 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'); }

vipertecpro commented 3 years ago

Yeah Yeah Yeah i got that all by myself , but thax alot for posting this in here, this will defiantly going to help someone else.