Skip to content

Commit

Permalink
Update admin.html
Browse files Browse the repository at this point in the history
  • Loading branch information
CardosoGuiVi authored Dec 27, 2024
1 parent f8b8be9 commit 0d9dc13
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<html>
<head>
<title>Admin Control</title>
<script src="https://www.gstatic.com/firebasejs/9.21.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.21.0/firebase-database.js"></script>
</head>
<body>
<h1>Controle do Site</h1>
Expand All @@ -17,7 +15,10 @@ <h1>Controle do Site</h1>
<option value="shake">Tremer</option>
</select>
<button id="update">Atualizar</button>
<script>
<script type="module">
import { initializeApp } from "https://www.gstatic.com/firebasejs/11.1.0/firebase-app.js";
import { getDatabase, ref, set, onValue } from "https://www.gstatic.com/firebasejs/11.1.0/firebase-database.js";

const firebaseConfig = {
apiKey: "AIzaSyD1_jce8AKIShD-10OQFHZMgtnPJbjC2pw",
authDomain: "piba-happy-new-year.firebaseapp.com",
Expand All @@ -28,13 +29,16 @@ <h1>Controle do Site</h1>
appId: "1:627238322422:web:6c25a982ce66f437fdacd7",
measurementId: "G-148ZJ9K8ZQ"
};
const app = firebase.initializeApp(firebaseConfig);
const db = firebase.database();

const app = initializeApp(firebaseConfig);
const db = getDatabase(app);

document.getElementById('update').addEventListener('click', () => {
const bgColor = document.getElementById('bg-color').value;
const animation = document.getElementById('animation').value;
db.ref('settings').set({ bgColor, animation });

console.log(ref(db, 'settings'));
set(ref(db, 'settings'), { bgColor, animation });
});
</script>
</body>
Expand Down

0 comments on commit 0d9dc13

Please sign in to comment.