Chapters
44 Chapters
|
4:19:56
|
Login to bookmark this video
-
Course Code
Subscribe to download the code!
Subscribe to download the code!
-
This Video
Subscribe to download the video!
Subscribe to download the video!
-
Subtitles
Subscribe to download the subtitles!
Subscribe to download the subtitles!
-
Course Script
Subscribe to download the script!
Subscribe to download the script!
09.
Add To Cart
Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!
Subscribe to jump to this part in the video!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
This course is also built to work with Vue 3!
What JavaScript libraries does this tutorial use?
// package.json
{
"devDependencies": {
"@fortawesome/fontawesome-free": "^5.15.1", // 5.15.1
"@symfony/webpack-encore": "^0.30.0", // 0.30.2
"axios": "^0.19.2", // 0.19.2
"bootstrap": "^4.4.1", // 4.5.3
"core-js": "^3.0.0", // 3.6.5
"eslint": "^6.7.2", // 6.8.0
"eslint-config-airbnb-base": "^14.0.0", // 14.2.0
"eslint-plugin-import": "^2.19.1", // 2.22.1
"eslint-plugin-vue": "^6.0.1", // 6.2.2
"regenerator-runtime": "^0.13.2", // 0.13.7
"sass": "^1.29.0", // 1.29.0
"sass-loader": "^8.0.0", // 8.0.2
"vue": "^2.6.11", // 2.6.12
"vue-loader": "^15.9.1", // 15.9.4
"vue-template-compiler": "^2.6.11", // 2.6.12
"webpack-notifier": "^1.6.0" // 1.8.0
}
}
4 Comments
Hi,
Currently adding item to cart cause an issue.
I don't understand why, Cart seems well configured in ApiPlatform.
Hey @atournayre!
Hmmm. Are you getting this directly from the downloaded course code? Or trying things on a fresh project with newer dependencies? That line - 56 - from
ItemNormalizermight be getting triggered via the individualproductbeing denormalized. I see that we're sendingid: 1in the JSON. If you remove that before making the AJAX call, does that make things all better?On a high level, that IS the part that looks odd. We're sending a
productset to an object with@idAND individual fields. Usually, you do one or the other: setproductto an IRI string to tell AI Platform to use that existing product or set it to an object of data without an@id, which indicates that a new product should be created. Iirc, in the tutorial, we setproductto its@idstring - you can see that in this code block - https://symfonycasts.com/screencast/vue2/add-to-cart#codeblock-a668af6a6e - notice we're passingthis.product['@id'].Let me know if that helps :).
Cheers!
my phpstorm keeps doing stuff like this for auto importing. how do i fix it so that it will use the @ for home directory and add space around curly braces?
import {addItemToCart} from "../services/cart-service";
Hey Robin,
Probably take a look at Preferences in your PhpStorm, I don't know if that may be configured, but if it may be - it should be in preferences then. On mac, you can press "Commad" + "," shortcut, or go to PhpStorm menu -> Preferences.
I hope this helps.
Cheers!
"Houston: no signs of life"
Start the conversation!