Skip to content

Commit

Permalink
This is my pantry tracker app
Browse files Browse the repository at this point in the history
  • Loading branch information
rahatmoktadir03 committed Aug 8, 2024
1 parent cf2263a commit 76add72
Show file tree
Hide file tree
Showing 15 changed files with 6,646 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

.vercel
Binary file added app/favicon.ico
Binary file not shown.
19 changes: 19 additions & 0 deletions app/firebase.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { initializeApp } from "firebase/app";
import { getFirestore } from 'firebase/firestore';
import { getAuth } from 'firebase/auth';

const firebaseConfig = {
apiKey: "AIzaSyC2bXY514gP2FbinddsU071ySma8V_8PeY",
authDomain: "inventory-management-app-ca45e.firebaseapp.com",
projectId: "inventory-management-app-ca45e",
storageBucket: "inventory-management-app-ca45e.appspot.com",
messagingSenderId: "1080894091719",
appId: "1:1080894091719:web:1732d2015d33cb5b33a9e2",
measurementId: "G-ZX85XQX0ED"
};

const app = initializeApp(firebaseConfig);
const firestore = getFirestore(app);
export const auth = getAuth(app);

export { firestore };
5 changes: 5 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
17 changes: 17 additions & 0 deletions app/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Inter } from "next/font/google";
import "./globals.css";

const inter = Inter({ subsets: ["latin"] });

export const metadata = {
title: "Create Next App",
description: "Generated by create next app",
};

export default function RootLayout({ children }) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
</html>
);
}
38 changes: 38 additions & 0 deletions app/login.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { useState } from 'react';
import { useRouter } from 'next/router';
import { signInWithEmailAndPassword } from 'firebase/auth';
import { auth } from '../firebase';

export default function Login() {
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const router = useRouter();

const handleLogin = async () => {
try {
await signInWithEmailAndPassword(auth, email, password);
router.push('/inventory'); // Redirect to inventory page after login
} catch (error) {
console.error('Error logging in: ', error.message);
}
};

return (
<div>
<h1>Login</h1>
<input
type="email"
placeholder="Email"
value={email}
onChange={(e) => setEmail(e.target.value)}
/>
<input
type="password"
placeholder="Password"
value={password}
onChange={(e) => setPassword(e.target.value)}
/>
<button onClick={handleLogin}>Login</button>
</div>
);
}
Loading

0 comments on commit 76add72

Please sign in to comment.