Hey @iljido I wasnt able to replicate your error but what you have on your component looks correct. I've had issues with the json_encode helper in the past, but if its a show route and your only showing a specific thread not looping over several threads.
in the controller that supplies the thread variable try this
Controller
public function test()
{
$thread = new RandomThing();
$isThreadSubscribedTo = $thread->isSubscribedTo;
return view('test', compact('isThreadSubscribedTo'));
}
Component
<template>
<button :class="classes" @click="subscribe">Subscribe</button>
</template>
<script>
import axios from 'axios';
export default {
props: ['active'],
computed: {
classes(){
return ['btn' , this.active ? 'btn-primary' : 'btn-outline-primary'];
}
},
methods: {
subscribe(){
// axios[(this.active ? 'delete' : 'post')](location.pathname + '/subscriptions');
console.log(this.active);
this.active = ! this.active;
}
}
}
</script>
check your console and see what its spitting out, is a boolean value if so this could be a temporary solution till you figure out whats wrong with your json encode syntax I believe json_encode calls typically look like this and it bundles it up the array like a object, key => value
echo json_encode([
'status' => 'success',
'data' => $data,
]);