프론트엔드/Nuxt
-
Nuxt 채팅 구현하기 #pusher #nuxt #vue #laravel프론트엔드/Nuxt 2023. 4. 26. 22:55
# What?- nuxt에 pusher 세팅하기 # How?npm install pusher-js {{message.body}} * 주의사항 laravel broadcastOn할 때 PrivateChannel 아닌 그냥 Channel 써야함@ MessageCreated.phpmessage = MessageResource::make($message); // $this->dontBroadcastToCurrentUser(); } /** * Get the channels the event should broadcast on. * * @return \Illuminate\Broadcasting\..
-
axios에 전역에러처리하기 #global #error #catch #error프론트엔드/Nuxt 2023. 4. 6. 18:52
# What? - axios 후 에러있을때마다 공통으로 해주는 작업이 있을 때 전역처리하는법 # How? npm install @nuxtjs/axios @ plugins/axios.js export default function ({ $axios, redirect, store }) { $axios.onError(error => { if(error.response.status == 401) return null; // store.commit('setPop', error.message); if(error.response.status == 422) return alert("입력값을 확인해주세요."); if(error.response.data && error.response.data.message) return..