ALI
ALI
Explore posts from servers
AAlokai
Created by ALI on 6/28/2024 in #🙋|general-help
Trying to add Storefront UI in nuxt 3
No description
1 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