Changeset 2a2614e for ReserveNGo-frontend/src
- Timestamp:
- 01/26/25 00:32:02 (3 months ago)
- Branches:
- master
- Children:
- 231918f
- Parents:
- 9bcad23
- Location:
- ReserveNGo-frontend/src
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
ReserveNGo-frontend/src/App.vue
r9bcad23 r2a2614e 1 <script setup>1 <script> 2 2 //import { RouterLink, RouterView } from 'vue-router' 3 3 import NavBar from './components/Project/Nav_bar_new.vue' 4 4 import Footer_ from '@/components/Project/Footer_.vue' 5 import { userStore } from '@/PiniaStores/UserStore.js' 5 6 6 7 8 9 10 7 export default { 8 components: { 9 NavBar, 10 Footer_, 11 }, 12 beforeMount() { 13 userStore().getLocalStorage() 14 }, 15 } 11 16 </script> 12 17 13 18 <template> 14 <!-- <header>19 <!-- <header> 15 20 <img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" /> 16 21 … … 30 35 <NavBar></NavBar> 31 36 <main> 32 <router-view />37 <router-view /> 33 38 </main> 34 39 <footer> … … 41 46 </div> 42 47 43 44 45 46 47 48 <!-- <Locale_listing_container></Locale_listing_container> 48 <!-- <Locale_listing_container></Locale_listing_container> 49 49 <Locale_listing_container></Locale_listing_container> 50 50 <Locale_listing_container></Locale_listing_container>--> 51 52 53 51 </template> 54 52 55 53 <style scoped> 56 57 54 .wrapper { 58 55 display: flex; … … 64 61 flex: 1; /*istrazi*/ 65 62 } 66 footer {67 background: #8377 D1;63 footer { 64 background: #8377d1; 68 65 } 69 66 70 template{ background: #FBFFF1;} 67 template { 68 background: #fbfff1; 69 } 71 70 /*header { 72 71 line-height: 1.5; -
ReserveNGo-frontend/src/PiniaStores/UserStore.js
r9bcad23 r2a2614e 38 38 this.data = JSON.parse(nonparsed); 39 39 } 40 }, 41 clearLocalStorage() { 42 43 this.data = { 44 id: 0, 45 firstName: "", 46 lastName: "", 47 email: "", 48 phoneNumber: "", 49 role: "UN_AUTHENTICATED", 50 token: "" 51 } 52 localStorage.setItem('userData', JSON.stringify(this.data)); 53 40 54 } 41 55 -
ReserveNGo-frontend/src/components/Project/Nav_bar_new.vue
r9bcad23 r2a2614e 3 3 4 4 import { userStore } from '@/PiniaStores/UserStore.js' 5 import logout_ from '@/components/Project/logout_.vue' 6 5 7 6 8 export default { … … 9 11 userStore_: userStore() 10 12 } 13 }, 14 components: { 15 logout_ 11 16 } 17 12 18 } 13 19 … … 78 84 <li class="nav-item ms-2 d-none d-md-inline"> 79 85 <router-link to="/login" > 80 <a class="btn btn-dark">Login</a>86 <a v-if="userStore_.data.role==='UN_AUTHENTICATED'" class="btn btn-dark">Login</a> 81 87 </router-link> 82 88 <router-link to="/register"> 83 <a class="btn btn-dark ms-2">Register</a>89 <a v-if="userStore_.data.role==='UN_AUTHENTICATED'" class="btn btn-dark ms-2">Register</a> 84 90 </router-link> 91 <logout_></logout_> 85 92 </li> 86 93 -
ReserveNGo-frontend/src/components/Project/login_.vue
r9bcad23 r2a2614e 3 3 4 4 import { userStore } from '@/PiniaStores/UserStore.js' 5 6 import {useRouter} from 'vue-router' 7 import router from '@/router/index.js' 5 8 6 9 export default { … … 16 19 userStore_: userStore(), 17 20 21 router: useRouter() 22 18 23 } 19 24 }, 20 25 methods: { 21 /*async makeLogin() {26 async makeLogin() { 22 27 23 28 await fetch(this.url, { … … 29 34 }) 30 35 }).then((response) => response.json()) 31 .then(json => ) 36 .then(json => {this.userStore_.setLocalStorage(json); 37 router.push('/')}) 32 38 33 } */39 } 34 40 } 35 41 } … … 43 49 44 50 <div class="row justify-content-center "> 45 51 <!-- <form v-on:submit.prevent="makeLogin">--> 46 52 <!-- <form action="http://localhost:8080/api/auth/login" method="POST">--> 47 53 <div class="col-3"> -
ReserveNGo-frontend/src/components/Project/register_.vue
r9bcad23 r2a2614e 3 3 4 4 import { userStore } from '@/PiniaStores/UserStore.js' 5 import {useRouter} from 'vue-router' 6 import router from '@/router/index.js' 5 7 6 8 export default { … … 28 30 },*/ 29 31 userStore_: userStore(), 30 31 //NE ZABORAVAJ TREBA DA SREDIS VCITUVANJE NA data od userStore na pocetok na stranicata 32 router: useRouter() 32 33 33 34 } … … 46 47 phoneNumber: this.form_info.phoneNumber}) 47 48 }).then((response) => response.json()) 48 .then((json) => {this.userStore_.setLocalStorage(json)}) 49 .then((json) => {this.userStore_.setLocalStorage(json); 50 router.push('/')}) 49 51 //console.log("Data received:", this.data); 50 52 //this.userStore_.setLocalStorage(json)
Note:
See TracChangeset
for help on using the changeset viewer.