Skip to content

Commit c450f88

Browse files
committed
Revert "Merge branch 'main' of https://github.com/UTDallasEPICS/Soccer-Robots"
This reverts commit 250d322, reversing changes made to 67b5d0b.
1 parent 250d322 commit c450f88

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+402
-2453
lines changed

components/Button.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template lang="pug">
2+
button.rounded-lg.py-1.px-3.text-white.font-bold
3+
slot
4+
</template>
5+
6+
<script setup lang="ts">
7+
</script>
File renamed without changes.
File renamed without changes.

components/NavBars/BottomNavBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<p class="nav-item dark:text-[#C0C0C0]" v-if="isLoggedIn" @click="openChangeUsername"> Change Username </p>
1616
</div>
1717
<div class="nav-item" v-if="isAdmin" @click="openAdminPanel">Admin</div>
18-
<div> <Profile /> </div>
18+
<div class="nav-login"> <TopRightNavbar /> </div>
1919
</div>
2020
</div>
2121
<!-- overlays -->
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<template>
2+
<div class="Login">
3+
<Profile v-if="userTrue"></Profile>
4+
<LogInSignUp v-else></LogInSignUp>
5+
</div>
6+
<!--Show this component if they need to choose a username.-->
7+
<LogInOverlay v-if="showLogIn" @closeLogIn="closing"></LogInOverlay>
8+
</template>
9+
10+
<script setup lang="ts">
11+
const userTrue = ref(false)
12+
//Gets authentication cookie.
13+
const srtoken = useCookie('srtoken')
14+
//If able to get the cookie, means we have a user logged in already
15+
if(srtoken.value){
16+
userTrue.value = true
17+
}
18+
const showLogIn = ref(false)
19+
//gets cookie for the user itself
20+
const sruser = useCookie('sruser')
21+
//if the authentication worked but could not get the user, means they have to login
22+
if(srtoken.value != '' && sruser.value == ''){
23+
showLogIn.value = true
24+
}
25+
//closes the login page
26+
const closing = () => {
27+
showLogIn.value = false
28+
userTrue.value = true
29+
}
30+
31+
</script>
32+
33+
34+
<style scoped>
35+
</style>
Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,13 @@
2020
</template>
2121

2222
<script setup lang="ts">
23-
import { navigateTo } from '#app'
24-
2523
import type { Player } from '@prisma/client'
2624
//to get play info like username, we use the cookie we have of them and find their username from it
2725
const getUser = useCookie<Partial<Player>>('sruser')
2826
let username = getUser.value?.username as string
29-
//clear cookis and send user to homepage
27+
//send the user to the logout page.
3028
const logout = async () => {
31-
try {
32-
33-
await $fetch('/api/user.logout', { method: 'POST' })
34-
35-
document.cookie = 'sruser=; Max-Age=0; path=/;'
36-
37-
38-
await navigateTo('/')
39-
40-
} catch (error) {
41-
console.error("Logout failed:", error);
42-
}
29+
window.location.href='api/logout'
4330
}
4431
</script>
4532

0 commit comments

Comments
 (0)