On post 500 Internal Server Error

Posted 2 years ago by vishalpardeshi
  1. I am using vue.js as front end and laravel as backend
  2. I have a problem POST http://localhost:8000/api/get-user-conversation 500 (Internal Server Error)

My controller code

namespace App\Http\Controllers;

use App\Chat;
use App\Http\Requests;
use Illuminate\Http\Request;
class ChatController extends Controller
 public function getUserConversationById (Request $request)
$userId = $request->input('id');
$authUserId = $request->user()->id;
$chats = Chat::whereIn('sender_id', [$authUserId,$userId])
    ->whereIn('receiver_id', [$authUserId,$userId])
    ->orderBy('created_at', 'desc')
return response(['data' => $chats], 200);

My Route api.php

Route::post('get-user-conversation', '[email protected]');


in chatstore.js const actions the value are avaliable in console but not geting value in Chatcontroller. $authUserId

setCurrentChatUser: ({commit}, user) => {
commit('SET_CURRENT_CHAT_USER', user)
let postID = {id: user.id}  
console.log(getUserConversationUrl, postID, {header: getHeader()})         
return Vue.http.post(getUserConversationUrl, postID, {header:       getHeader()})
.then(response => {          
commit('SET_CURRENT_CHAT_USER', user)
commit('SET_CONVERSATION', response.body.data)

getting Uncaught (in promise)

Please sign in or create an account to participate in this conversation.