Created
April 26, 2024 10:40
-
-
Save enomoto/6f3a74d4b264825cdf625d91e08a860b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// login_form_hook | |
// | |
document.querySelector("#customer_login")?.addEventListener("submit", () => { | |
const email = document.querySelector('input[name="customer[email]"]')?.value ?? "" | |
const object = { | |
"email": email, | |
} | |
webkit.messageHandlers.accountLogin.postMessage(object) | |
}) | |
// | |
// registration_form_hook | |
// | |
document.querySelector("#create_customer")?.addEventListener("submit", () => { | |
const email = document.querySelector('input[name="customer[email]"]')?.value ?? "" | |
const firstName = document.querySelector('input[name="customer[first_name]"]')?.value ?? "" | |
const lastName = document.querySelector('input[name="customer[last_name]"]')?.value ?? "" | |
const password = document.querySelector('input[name="customer[password]"]')?.value ?? "" | |
const birthday = document.querySelector("#birthday")?.value ?? "" | |
const object = { | |
"email": email, | |
"firstName": firstName, | |
"lastName": lastName, | |
"password": password, | |
"birthday": birthday | |
} | |
webkit.messageHandlers.accountRegister.postMessage(object) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment