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 ...
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 ...
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 ...
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.
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 ...
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 ...
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 ...
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 ...
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
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 ...
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 ...
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 ...
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 ...
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()
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
vue × 18craft3 × 6
ajax × 3
graphql × 3
templating × 2
plugin-freeform × 2
plugin-craftcommerce3 × 2
frontend-form × 2
csrf × 2
headless × 2
plugin-craftcommerce × 1
database × 1
form × 1
php × 1
plugin-elementapi × 1
login × 1
redirect × 1
javascript × 1
json × 1
security × 1
freeform × 1
include × 1
authentication × 1
entry-form × 1
plugin-craftql × 1