From 0a6c72c985ccdd7f51c2680079788ab2815c14ab Mon Sep 17 00:00:00 2001 From: hudaputrasantosa Date: Mon, 1 Apr 2024 04:22:28 +0700 Subject: [PATCH] updt: dev environtment and production environtment --- .env.example | 7 +++++++ .github/workflows/deploy.yaml | 2 +- src/helpers/VisitorCounter.js | 22 +++++++--------------- src/pages/About/index.jsx | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..36454e8 --- /dev/null +++ b/.env.example @@ -0,0 +1,7 @@ + VITE_REACT_API_KEY= + VITE_REACT_AUTH_DOMAIN= + VITE_REACT_PROJECT_ID= + VITE_REACT_STORAGE_BUCKET= + VITE_REACT_MESSAGE_SENDER_ID= + VITE_REACT_ID= + VITE_REACT_MEASUREMENT_ID= \ No newline at end of file diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index dddb3bb..1a8a82b 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -26,7 +26,7 @@ env: jobs: # Single deploy job since we're just deploying deploy: - environment: + environment: production name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest diff --git a/src/helpers/VisitorCounter.js b/src/helpers/VisitorCounter.js index d2056ab..0568855 100644 --- a/src/helpers/VisitorCounter.js +++ b/src/helpers/VisitorCounter.js @@ -7,28 +7,20 @@ import { getFirestore } from "firebase/firestore"; // Your web app's Firebase configuration // For Firebase JS SDK v7.20.0 and later, measurementId is optional -// const apiKey = import.meta.env.REACT_APP_API_KEY; -// const authDomain = import.meta.env.REACT_APP_AUTH_DOMAIN; -// const projectId = import.meta.env.REACT_APP_PROJECT_ID; -// const storageBucket = import.meta.env.REACT_APP_STORAGE_BUCKET; -// const messagingSenderId = import.meta.env.REACT_APP_MESSAGE_SENDER_ID; -// const appId = import.meta.env.REACT_APP_ID; -// const measurementId = import.meta.env.REACT_APP_MEASUREMENT_ID; const firebaseConfig = { - apiKey: "AIzaSyAkC1sjCaxombGRV69tK7SorH2vI08memw", - authDomain: "counter-page-6279b.firebaseapp.com", - projectId: "counter-page-6279b", - storageBucket: "counter-page-6279b.appspot.com", - messagingSenderId: "761417323989", - appId: "1:761417323989:web:b781e8fb4e6b49156c595c", - measurementId: "G-5CDK9SRB5W", + apiKey: import.meta.env.VITE_REACT_API_KEY, + authDomain: import.meta.env.VITE_REACT_AUTH_DOMAIN, + projectId: import.meta.env.VITE_REACT_PROJECT_ID, + storageBucket: import.meta.env.VITE_REACT_STORAGE_BUCKET, + messagingSenderId: import.meta.env.VITE_REACT_MESSAGE_SENDER_ID, + appId: import.meta.env.VITE_REACT_ID, + measurementId: import.meta.env.VITE_REACT_MEASUREMENT_ID, }; // Initialize Firebase const app = initializeApp(firebaseConfig); const db = getFirestore(app); -// initializeApp(firebaseConfig); // const analytics = getAnalytics(app); export default db; diff --git a/src/pages/About/index.jsx b/src/pages/About/index.jsx index 6c541a0..c78ade7 100644 --- a/src/pages/About/index.jsx +++ b/src/pages/About/index.jsx @@ -13,7 +13,7 @@ import { doc, getDoc, updateDoc } from "firebase/firestore"; import db from "../../helpers/VisitorCounter"; const About = () => { - const [visitor, setVisitor] = useState(0); + const [visitor, setVisitor] = useState(); useEffect(() => { const docRef = doc(db, "portofolio", "visitor");