Category : reactjs

hello I have a problem in react and laravel sanctum, it’s running fine when I test on postman, but it showing an error 401 Unauthorized when I implementing it in react i put this on my .env laravel file SANCTUM_STATEFUL_DOMAINS=localhost:3000 SESSION_DRIVER=cookie SESSION_DOMAIN=localhost this my stateful domain ‘stateful’ => explode(‘,’, env( ‘SANCTUM_STATEFUL_DOMAINS’, ‘localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1,’ . parse_url(env(‘APP_URL’), PHP_URL_HOST), ..

Read more

so iam trying to use the charge function to charge a user one time i am using laravel and react with the stripe ui elements i installed cashier on laravel then wrote this endpoint public function pay(Request $request) { $user = Auth::user(); try { $payment = $user->charge( $request->amount, $request->token ); $payment = $payment->asStripePayemnet(); return response()->json([‘message’ ..

Read more

I am doing a project using Laravel and react.js. I need to select only one image out of this list of images : The code of above picture, <table> <tbody> <tr> <td class="cactus"> <img src="../assets/images/Echeveria-colorata.jpg" alt="Generic placeholder image" /> Echeveria-colorata</td> <td class="cactus"><img src="../assets/images/Echeveria-imbricata.jpg" alt="Generic placeholder image" />Echeveria-imbricata</td> <td class="cactus"><img src="../assets/images/Graptopetalum-paraguayense.jpg" alt="Generic placeholder image" />Ghost Plant</td> ..

Read more

I have an issue with my project. I am passing the data through reactjs in the front end, but the value is not getting in the backend. Can anyone say what is the problem. $cert = new certificate; $val = Validator::make($req->all(), $cert->createRules); if ($val->fails()) { return response()->json($val->errors(), 422); } $cert->prize = $req->prize; $cert->name = $req->name; ..

Read more

My OS is Mojave 10.16.6, browser Safari 14.1.1. I ve developed an API with a token-based authentication. The token gets put into a cookie and is than sent to the browser and back to the server until logout. Here is the blog I used as blueprint: https://medium.com/@shindelav/make-an-api-based-application-with-laravel-passport-d6f1074a7b3a Later I`ve adopted the session.php like this because ..

Read more

branchsetup.js DataTable() { return this.state.officeid.map((res, i) => { return <Branchdrop obj={res} key={i} />; }); } //with this function it goes to Branchdrop to make the options for select getofficeid(e) { // e.preventdefault(); e.preventDefault(); axios.get(‘http://127.0.0.1:8000/api/find_office_id’) .then(res => { const officeid = res.data; this.setState({ officeid }); }) } // I find the officeid from database and then ..

Read more

I’m getting the following warning on my application with Laravel + InertiaJS + React: Warning: Can’t perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function." I’m doing the example ..

Read more

I have this raw query that generates a csv, and it is returning 2 dates in ‘hardcode mode’ I would like to replace these values ​​by variables how do I do? In this case it would be the variables injected by the ‘post’ with the axios coming from a component of React.js. The query is ..

Read more

I have this form and I am not able to ‘submit’, the following error message appears, when I click on the ‘submit ‘ button ReactJS File: …//rest of the code omitted function onSubmit(evt) { evt.preventDefault() axios.post(`${process.env.REACT_APP_MY_API_URL}/api/orders/orders-csv` , values ).then((response) => { history.push(‘/orders-csv’) console.log(‘response: ‘) console.log(response) }) } …//rest of the code omitted <Modal.Body className="py-0 border"> ..

Read more

I have created a JSON file with few objects with child properties. I want to map the value of properties in each object. for one line inside return will work fine {Object.keys(field.option).map((keys) => { return ( <input type="radio" key={keys} id="male" name="gender" value={field.option[keys]}/> ); })} when I’m trying to add several code lines inside return it ..

Read more