Skip to main content
3 votes

Axios post function got 400 bad request

Just found the solution: npm install qs and import qs from 'qs' ... const actions = { auth({ commit }, { email, password }) { axios.post('url', qs.stringify({ your token ...
yu xia's user avatar
  • 397
2 votes
Accepted

Setting up VueJS in a Craft CMS Project

They don't need to clash per se, but it depends on the way you build your project structure. I'm front-end focussed, so my setup is like: projectfolder src public public (you could ...
Friksel's user avatar
  • 180
2 votes
Accepted

CraftCMS + GraphQL - orderBy Random?

RAND() is the correct way to do this. (At least, it works in 3.5). One catch is that GraphQL queries are cached by default, so your results will always be returned in the same random order until your ...
Dalton Rooney's user avatar
2 votes
Accepted

getting active userid by GraphQL?

with a get request from /index.php?p=admin/actions/users/session-info&dontExtendSession=1 I can get my CSRF Code + the User ID. Great.
Peter L's user avatar
  • 86
2 votes
Accepted

How to use ajax call to retrieve data from craft cms entries to use in php application

You'll need to expose some sort of API that your JavaScript can use to request data from your Craft install. There are two first-party options: Craft CMS has had GraphQL support built into core since ...
Mats Mikkel Rummelhoff's user avatar
1 vote

Freeform to show via Vue Js

It sounds to me like you're running into a collision with Vue's template delimiters vs Twig's, which by default are the same as each other ({{ ... }}). The solution is to change Vue's delimiters to ...
James Smith's user avatar
  • 5,689
1 vote

Getting a new cart after adding the product in decoupled frontend

UPD 2: Spending more hours gave me the solution: It seems like Ajax generates a new sessionId with each call, so it's impossible to preserve cart along with session Id in that case. As workaround I ...
Alex89's user avatar
  • 183
1 vote

Getting a new cart after adding the product in decoupled frontend

UPD: after some hours of research I found the solution in this topic: CORS preflight check failing for AJAX login form on different domain Also I had to pass the orderNumber parameter with the value ...
Alex89's user avatar
  • 183
1 vote
Accepted

Logging in to Craft via Vue/Javascript apps

And just like that I stumble over this wonderful blog post https://digitalevangelist.net/blog/vuejs-craft-cms-single-page-app-logging-in-to-craft
dmatthams's user avatar
  • 2,502
1 vote

How save data from form in headless Craft via Vue.js

You would not use the headless API to submit content in into Craft, as neither the GraphQL or Element APIs support writing. The frontend entry form functionality is fairly well documented. You would ...
Jeremy Gimbel's user avatar
1 vote
Accepted

Using a Redirect plugin in conjuction with a wildcard route

The way Retour works, it doesn't do anything until Craft throws a 404 error. Some other plugins do this as well. Your route is such that anything Craft can't find goes to your SPA; that means Craft ...
andrew.welch's user avatar
  • 11.6k
1 vote

Using a Redirect plugin in conjuction with a wildcard route

I ended up making a 404 template (which in atuality is the SPA index file) This causes the Craft redirects to take effect, and have the SPA as a fallback route. This means in Production i don't need ...
Hyra's user avatar
  • 123
1 vote

FreeForm and Vue - Hidden Forms in Modal - Manually refresh the Craft CRSF token and Freeform JS Honeypot field

Not sure if it's a good call or not but you could have an endpoint that just has the {{ craft.app.request.csrfToken }} outputting on it. Poll(GET) that using ajax (axios or whatever you're using in ...
billythekid's user avatar
1 vote
Accepted

How to get an element query into json (for vue) without extra data?

You can use the asArray function to return arrays instead of elements {% set sections = craft .categories .group('teamCategory') .select(['title','elements.id','groupId']) .asArray() ...
Robin Schambach's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible