-
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.
Merge pull request #207 from Sahil-Connect/SAH-96
[SAH-96]: Generate magic invitation link
- Loading branch information
Showing
45 changed files
with
6,030 additions
and
971 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
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
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
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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
export default function Agents() { | ||
return ( | ||
<section className="space-y-2"> | ||
<div> | ||
<h1>Agents Page</h1> | ||
</div> | ||
</section> | ||
); | ||
} | ||
|
||
return ( | ||
<section className="space-y-2"> | ||
<div> | ||
<h1>Agents Page</h1> | ||
</div> | ||
</section> | ||
); | ||
} |
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
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,40 @@ | ||
import { useEffect, useState } from "react"; | ||
import { useRouter } from "next/router"; | ||
import { signIn, useSession } from "next-auth/react"; | ||
|
||
const VerifyPage = () => { | ||
const router = useRouter(); | ||
const { status } = useSession(); | ||
const { token } = router.query; | ||
const [error, setError] = useState<string | null>(null); | ||
|
||
useEffect(() => { | ||
if (token && status === "unauthenticated") { | ||
signIn("email", { token, redirect: false }).then((result) => { | ||
if (result?.error) { | ||
console.error("Verification failed:", result.error); | ||
setError(result.error); | ||
// Handle error (e.g., show error message to user) | ||
} else { | ||
// Successful verification, redirect to appropriate page | ||
router.push(result?.url!); | ||
} | ||
}); | ||
} else if (status === "authenticated") { | ||
// User is already signed in, redirect to appropriate page | ||
router.push("/"); | ||
} | ||
}, [token, status, router]); | ||
|
||
if (status === "loading") { | ||
return <div>Loading...</div>; | ||
} | ||
|
||
if (error) { | ||
return <div>Error: {error}</div>; | ||
} | ||
|
||
return <div>Verifying your email...</div>; | ||
}; | ||
|
||
export default VerifyPage; |
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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
export default function Clients() { | ||
return ( | ||
<section className="space-y-2"> | ||
<div> | ||
<h1>Clients Page</h1> | ||
</div> | ||
</section> | ||
); | ||
} | ||
|
||
return ( | ||
<section className="space-y-2"> | ||
<div> | ||
<h1>Clients Page</h1> | ||
</div> | ||
</section> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
export default function Orders() { | ||
return ( | ||
<section className="space-y-2"> | ||
<div> | ||
<h1>Orders Page</h1> | ||
</div> | ||
</section> | ||
); | ||
} | ||
|
||
return ( | ||
<section className="space-y-2"> | ||
<div> | ||
<h1>Orders Page</h1> | ||
</div> | ||
</section> | ||
); | ||
} |
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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
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 @@ | ||
export * from "./url"; |
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,16 @@ | ||
const { ADMIN_URL, AGENT_URL, CLIENT_URL, COURIER_URL, SERVER_URL } = | ||
process.env; | ||
if (!ADMIN_URL || !AGENT_URL || !CLIENT_URL || !COURIER_URL || !SERVER_URL) { | ||
throw new Error("Missing required environment variables for Apps url"); | ||
} | ||
|
||
export const URLS = { | ||
development: SERVER_URL, | ||
staging: {}, | ||
production: { | ||
admin: ADMIN_URL!, | ||
agent: AGENT_URL!, | ||
client: CLIENT_URL!, | ||
courier: COURIER_URL!, | ||
}, | ||
}; |
Oops, something went wrong.