-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf2263a
commit 76add72
Showing
15 changed files
with
6,646 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
* { | ||
box-sizing: border-box; | ||
padding: 0; | ||
margin: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
Oops, something went wrong.