ALI
ALI
Explore posts from servers
NNuxt
Created by ALI on 9/12/2024 in #❓・help
Client Side Rendering
i have a nuxt 3 app, it has following directory structure: myApp apps (there are others which I do not think are important to mention) server -> it has customQueries and src folder and middleware configs among others web -> it has pages, assets, components, config, sdk, server, layouts, composables, utils etc. when I run my app with yarn, I run it from inside myApp directory. it runs both the server and the web. that was essentially because we want to utilize power of server and send our magento queries through sdk, which goes through our server to the magento. later, we decided to get rid of sdk and send direct calls to magento and for that we created a function inside web/server directory and added code for JS fetch api, that would be sending calls to the magento url. Now, to use that api, we employed useFetch of nuxt 3 in each composable to send call to the api and then that would call the magento backend. but when I run the code from web directory to bypass the server, nothing happens and no network call is seen, which otherwise would occur even if I use fetch api. how can I fix this? PS: the method works for homepage banners and messages but it doesn't work of product page. (these are the only places I have implemented it yet).
1 replies
NNuxt
Created by ALI on 7/23/2024 in #❓・help
Custom Error page.
Hello everyone! I have built a custom error page but I am also using catch all route. ([...slug].vue). Now, it has become very hard to catch those errors. if i am getting 500 error it will not catch it and display it etc. any advice in the matter is appreciated.
2 replies
NNuxt
Created by ALI on 7/9/2024 in #❓・help
Nuxt 3 error handling
I have nuxt 3 app and I am using catch all route in my pages direcotry. Now, for testing purposes I just gave an incorrect baseURL and graphQL URL in my env file for server. I do get 500 status for the category page when I try to open it. but I expect to be redirected to an error page. First I made it the custom error page in the root directory but then for some reason i had to make it a separate component of my own inside components dir. Now, the problem is, my useError composable is undefined in composables/error.vue. so, can not display right message. I have even used error boundaries but still the same problem ~/error.vue and ~/composables/Error/index.vue are same.
1 replies
NNuxt
Created by ALI on 7/4/2024 in #❓・help
incorrect favicon appears when we try to share the link of the app on whatsapp.
when I share the link of app in whatsapp, it doesn't show my favicon. it shows default. what would be wrong?
2 replies
AAlokai
Created by ALI on 6/28/2024 in #🙋|general-help
Trying to add Storefront UI in nuxt 3
No description
1 replies
NNuxt
Created by ALI on 6/28/2024 in #❓・help
Trying to add Storefront UI Module
No description
1 replies
NNuxt
Created by ALI on 6/24/2024 in #❓・help
Custom Error Page
Hi, I have created a custom error page and place .vue file in the root directory. Now, whenever there is a page that doesn''t exist; it automatically redirects to error.vue but in the Network tab I still see the status to be 200. it should be 404. help with that please, thanks '
42 replies
NNuxt
Created by ALI on 5/23/2024 in #❓・help
Duplicate modules in Lighthouse performance test
No description
3 replies
AAlokai
Created by ALI on 1/31/2024 in #🙋|general-help
custom query to change customer password
Hi, I'm trying to change password for an existing cutomer using graphql mutations. I have a vsf2nuxt3 app and I just implemented user authentication. Now, I want to implement change password feature for a user. I am trying changeCustomerPassword method from magento sdk. I am able to change password successfully but graphql returns me the fields that I do not require I want it to return the fields that I have written in my custom query. below is my code:
const changePasswordInput: ChangeCustomerPasswordInput = {
currentPassword: formData.value.currentPassword,
// eslint-disable-next-line unicorn/no-keyword-prefix
newPassword: formData.value.freshPassword,
};

try {
const { data } = await useAsyncData(() =>
useSdk().magento.changeCustomerPassword(changePasswordInput, {
customHeaders,
customQuery: passwordChangeCustomQuery,
}),
);
console.log(data, 'password changed!');
if (data.value?.errors) {
state.value.error = data.value.errors?.[0].message;
}
} catch (error) {
state.value.error = error as string;
}
const changePasswordInput: ChangeCustomerPasswordInput = {
currentPassword: formData.value.currentPassword,
// eslint-disable-next-line unicorn/no-keyword-prefix
newPassword: formData.value.freshPassword,
};

try {
const { data } = await useAsyncData(() =>
useSdk().magento.changeCustomerPassword(changePasswordInput, {
customHeaders,
customQuery: passwordChangeCustomQuery,
}),
);
console.log(data, 'password changed!');
if (data.value?.errors) {
state.value.error = data.value.errors?.[0].message;
}
} catch (error) {
state.value.error = error as string;
}
custom query:
export const passwordChangeCustomQuery: {
changeCustomerPassword: string;
metadata?: { fields: string };
} = {
changeCustomerPassword: 'password-change-custom-mutation',
metadata: {
fields: `
email
firstname
lastname
gender
id
addresses {
city
company
country_code
default_billing
default_shipping
id
postcode
region {
region
region_code
region_id
}
street
telephone
}
`,
},
};
export const passwordChangeCustomQuery: {
changeCustomerPassword: string;
metadata?: { fields: string };
} = {
changeCustomerPassword: 'password-change-custom-mutation',
metadata: {
fields: `
email
firstname
lastname
gender
id
addresses {
city
company
country_code
default_billing
default_shipping
id
postcode
region {
region
region_code
region_id
}
street
telephone
}
`,
},
};
1 replies
AAlokai
Created by ALI on 11/22/2023 in #🙋|general-help
VSF2-Nuxt3 app integrated with Magento 2.
No description
2 replies
AAlokai
Created by ALI on 11/21/2023 in #🙋|general-help
Sotring cookies for magento 2 using ```vsf-customer```
I have integrated Magento 2 sdk in my vsf app. For use Authentication, I am using
createCustomer
createCustomer
method with custom graphQL query and then I use
generateCustomerToken
generateCustomerToken
method to generate Token for authentication. Now, I want to store this token in cookies/localstorage. The documentation suggests that I should use
vsf-customer
vsf-customer
to store cookies because mthods like
customer, customerCart, updateCustomer, changeCustomerPassword
customer, customerCart, updateCustomer, changeCustomerPassword
use token stored in
vsf-customer
vsf-customer
. But, I haven't found any guide related to the usage of this method. Any help on it will be a huge helping hand for me. thanks
2 replies
AAlokai
Created by ALI on 11/15/2023 in #🙋|general-help
Response Filter
No description
3 replies