diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..37ced2e Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/index.html b/public/index.html index 0f97498..d35b8d0 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,8 @@ - + + Kompetenz Inventar der WTF eG diff --git a/src/App.vue b/src/App.vue index dee2924..b99daf3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,8 +1,67 @@ \ No newline at end of file + + \ No newline at end of file diff --git a/src/assets/custom.css b/src/assets/custom.css new file mode 100644 index 0000000..155a220 --- /dev/null +++ b/src/assets/custom.css @@ -0,0 +1,4 @@ +.container{ + min-height: calc(100vh - 70px - 24px); +} + \ No newline at end of file diff --git a/src/main.js b/src/main.js index aba5b45..a51e673 100644 --- a/src/main.js +++ b/src/main.js @@ -3,11 +3,15 @@ import App from './App.vue' import router from './router' import 'bootstrap/dist/css/bootstrap.min.css' +import './assets/custom.css' const app = createApp(App) app.use(router) +app.config.globalProperties.apiUrl= (process.env.VUE_APP_API_URL ? process.env.VUE_APP_API_URL : '') + app.mount('#app') -app.config.globalProperties.apiUrl="todo" \ No newline at end of file + + diff --git a/src/router/index.js b/src/router/index.js index f84586f..27267b6 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -9,7 +9,17 @@ const routes = [ path: '/s', name: 's', component: { - template: "" + template: "", + }, + beforeEnter: (to, from, next) => { + console.log('test') + console.log('token', localStorage.getItem('token')) + if(localStorage.getItem('token') !== null){ + console.log('next') + next() + }else{ + next({path: '/', query: {url: to.fullPath, access: false}}) + } }, children: [ { @@ -18,12 +28,12 @@ const routes = [ component: Search }, { - path: '/profile/:member', + path: 'profile/:member', name: 'ProfileMember', component: View }, { - path: '/profile-edit', + path: 'profile-edit', name: 'ProfileEdit', component: Edit }, diff --git a/src/views/Index.vue b/src/views/Index.vue index 55fd864..25664d6 100644 --- a/src/views/Index.vue +++ b/src/views/Index.vue @@ -57,24 +57,28 @@ export default { async submitLogin() { this.showErrorMessage = false; try { + console.log(this.apiUrl) const loginResult = await axios.post( - `${process.env.VUE_APP_API_URL}/users/login`, + `${this.apiUrl}/users/login`, { username: this.username, password: this.password, } ); console.log(loginResult); + console.log(loginResult.status); if (loginResult.status === 200) { + console.log('if true') + this.showErrorMessage = false; //success login - localStorage.setItem("token", loginResult.token); - localStorage.setItem("user_id", loginResult.user_id); - this.router.push({ path: "s/search" }); + localStorage.setItem("token", loginResult.data.token); + localStorage.setItem("user_id", loginResult.data.user_id); + this.$router.push({ path: "/s/search" }); } else { this.showErrorMessage = true; } } catch (error) { - console.error(); + console.error(error); this.showErrorMessage = true; } }, diff --git a/src/views/Search.vue b/src/views/Search.vue index 95d24ad..8abc381 100644 --- a/src/views/Search.vue +++ b/src/views/Search.vue @@ -1,58 +1,66 @@ \ No newline at end of file diff --git a/src/views/profile/Edit.vue b/src/views/profile/Edit.vue index a3f5e42..d1b91e8 100644 --- a/src/views/profile/Edit.vue +++ b/src/views/profile/Edit.vue @@ -9,7 +9,7 @@ type="text" class="form-control" id="nickname" - v-model="nickname" + v-model="profile.nickname" required /> @@ -19,7 +19,7 @@ type="text" class="form-control" id="pronouns" - v-model="pronouns" + v-model="profile.pronouns" required />
@@ -34,7 +34,7 @@ class="form-control" id="freetext" rows="3" - v-model="freetext" + v-model="profile.freetext" >
@@ -45,14 +45,16 @@ class="form-control" id="volunteerwork" rows="3" - v-model="volunteerwork" + v-model="profile.volunteerwork" >
- +
    -
  • {{result.name}}
  • + @click="addSkill(result)" + > + {{ result.name }} +
@@ -84,6 +89,46 @@
+
+ + +
+
    +
  • + {{ result.name }} +
  • +
+
+
+ + {{ language.name }} + + +
+
item.id)); + if (this.profile.skills.map((item) => item.id).includes(skill.id)) + return false; + this.profile.skills.push(skill); + this.searchSkillsText = ""; + this.searchSkillResults = []; }, removeSkill(skillId) { - this.skills = this.skills.filter((skill) => { + this.profile.skills = this.profile.skills.filter((skill) => { if (skillId === skill.id) { return false; } else { @@ -153,7 +256,36 @@ export default { } }); }, - searchLanguages() {}, + async searchLanguages() { + try { + const languageResult = await axios.get( + `${process.env.VUE_APP_API_URL}/languages?search=${this.searchLanguagesText}` + ); + if (languageResult.status === 200) { + this.searchLanguagesResult = languageResult.data.languages; + } + } catch (error) { + console.error(); + this.showErrorMessage = true; + } + }, + + addLanguage(language) { + if (this.profile.languages.map((item) => item.id).includes(language.id)) + return false; + this.profile.languages.push(language); + this.searchLanguagesText = ""; + this.searchLanguagesResult = []; + }, + removeLanguage(languageId) { + this.profile.languages = this.profile.languages.filter((language) => { + if (languageId === language.id) { + return false; + } else { + return true; + } + }); + }, }, }; \ No newline at end of file