Skip to content

Commit

Permalink
Changed routing on registere and added button on mainpage if not sign…
Browse files Browse the repository at this point in the history
…ed it
  • Loading branch information
Yashaswini-Sharma committed Sep 1, 2024
1 parent 4752ac3 commit a570d42
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions src/pages/MainPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@
<div class="main-page p-6 space-y-6">
<div class="main-page__introduction text-center">
<div class="main-page__welcome flex flex-col items-center mb-6">
<h1 class="text-4xl font-bold mb-4">Hi {{ personName }}!</h1>
<router-link

<!-- Check if personName exists -->
<h1 v-if="personName !== ''" class="text-4xl font-bold mb-4">Hi {{ personName }}!</h1>

<!-- If personName is null, show the Register button -->
<router-link v-else to="/register">
<button class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
Register
</button>
</router-link>
<router-link
to="/uploads"
class="text-xl font-semibold text-green-600 hover:text-blue-800"
>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ const handleSignUp = async (event: Event) => {
if (userType.value === 'Institute') {
userData.instituteName = instituteName.value;
}
router.push('/'); // Redirect to / if userType is not Institute
// Save user data and type in Firestore with walletAddress as docId
try {
Expand All @@ -157,9 +158,8 @@ const handleSignUp = async (event: Event) => {
// Redirect based on userType
if (userType.value === 'Institute') {
router.push('/new'); // Redirect to /new if userType is Institute
router.push('/'); // Redirect to /new if userType is Institute
} else {
router.push('/'); // Redirect to / if userType is not Institute
}
} catch (error) {
console.error("Error during sign up:", error.message);
Expand Down

0 comments on commit a570d42

Please sign in to comment.