<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form Input Wave</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>Please Login</h1>
<form>
<div class="form-control">
<input type="email" required id = "signUpEmail">
<label>Email</label>
</div>
<div class="form-control">
<input type="password" required id="signUpPassword">
<label>Password</label>
</div>
<button class = "loginbtn">Login</button>
<p class="text">Don't have an account? <a href="#"><button class ="registerbtn">Register</button></a></p>
</form>
</div>
<!--Firebase CDN -->
<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-app.js";
import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-analytics.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyA72wRUKnY6N137xz58QyfCPRp1rolS3TE",
authDomain: "loginproperty2211.firebaseapp.com",
projectId: "loginproperty2211",
storageBucket: "loginproperty2211.appspot.com",
messagingSenderId: "221879887215",
appId: "1:221879887215:web:259d02dce11102c9a3749a",
measurementId: "G-SJCK1MF8Y1"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
import { getAuth, createUserWithEmailAndPassword } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-app.js";
// 추가 코드 (버튼 이벤트_회원가입)
document.getElementsByClassName("registerbtn").addEventListener("click", (event) =>{
event.preventDefault()
const email = document.getElementById("signUpEmail").value
const password = document.getElementById("signUpPassword").value
const auth = getAuth();
createUserWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
// Signed in
const user = userCredential.user;
// ...
})
.catch((error) => {
console.log('error');
const errorCode = error.code;
const errorMessage = error.message;
// ..
});
console.log(email,password)
});
// Sign up with email and pass.
// const auth = getAuth();
// createUserWithEmailAndPassword(auth, email, password)
// .then((userCredential) => {
// // Signed in
// const user = userCredential.user;
// // ...
// })
// .catch((error) => {
// const errorCode = error.code;
// const errorMessage = error.message;
// // ..
// });
// [END auth_signup_password]
</script>
<script src="script.js"></script>
</body>
</html>
파이어베이스 붙이기 실패...
내일 console.log 찍어보면서 어디서 꼬이는지 확인해봐야겠다.