Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subscribers data added to databse #1296

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@reduxjs/toolkit": "^2.2.7",
"antd": "^5.19.3",
"aos": "^2.3.4",
"axios": "^1.7.2",
"boxicons": "^2.1.4",
"cors": "^2.8.5",
"dompurify": "^3.1.6",
Expand Down
5 changes: 3 additions & 2 deletions src/components/FAQs/FAQs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from "react";
import Modal from "react-modal";
import "./FAQs.css";
import { database } from "../../firebase/auth"; // Adjust the path according to your project structure
import { ref, set } from "firebase/database";
import { child, get, ref, set } from "firebase/database";

const FAQs = () => {
const [activeIndex, setActiveIndex] = useState(null);
Expand Down Expand Up @@ -51,11 +51,12 @@ const FAQs = () => {
const email = emailInput.value;
emailInput.value = "";

// Save email to Firebase Realtime Database
try {
const emailKey = email.replace(/[.#$/[\]]/g, "_"); // Replace invalid characters for Firebase keys
const emailRef = ref(database, `newsletter/emails/${emailKey}`);
await set(emailRef, { email });
console.log("Email added to Firebase Realtime Database:", email);

setIsModalOpen(true);
} catch (error) {
console.error("Error saving email to database:", error);
Expand Down
Loading