-
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.
- Loading branch information
Showing
10 changed files
with
191 additions
and
40 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<template> | ||
<div id="app"> | ||
<Navbar /> | ||
<b-form id="form" @submit.prevent @submit="onSubmit" v-if="show"> | ||
<label for="textUsername">Username</label> | ||
<b-input type="text" v-model="form.username" id="textUsername"/> | ||
<br/> | ||
<label for="textPassword">Password</label> | ||
<b-input type="password" id="textPassword" v-model="form.password" aria-describedby="passwordHelpBlock" /> | ||
<br/> | ||
<b-button type="submit" variant="primary">Log in</b-button> | ||
</b-form> | ||
|
||
<router-view></router-view> | ||
|
||
<Footer /> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import Navbar from '../../components/Navbar.vue' | ||
import Footer from '../../components/Footer.vue' | ||
export default { | ||
name: 'app', | ||
components: { | ||
Navbar, | ||
Footer | ||
}, | ||
data() { | ||
return { | ||
form: { | ||
username: '', | ||
password: '' | ||
}, | ||
show: true | ||
} | ||
}, | ||
methods: { | ||
onSubmit(evt) { | ||
evt.preventDefault() | ||
var username = this.form.username | ||
var password = this.form.password | ||
const baseURI = 'http://localhost:8000/api/v1/login' | ||
this.$http.post(baseURI, { | ||
'username':username, | ||
'password':password | ||
}) | ||
.then((result) => { | ||
//alert(JSON.stringify(result.data)) | ||
this.$cookies.set('token',result.data.token) | ||
this.$router.replace({path:'/helloworld'}) | ||
this.show = false | ||
}) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
#app { | ||
font-family: 'Avenir', Helvetica, Arial, sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
text-align: center; | ||
color: #2c3e50; | ||
} | ||
#form { | ||
padding-top: 5em; | ||
width: 50%; | ||
text-align: center; | ||
display: inline-block; | ||
} | ||
html { | ||
background-color: #ffffff; | ||
} | ||
</style> |
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,20 @@ | ||
import Vue from 'vue' | ||
import App from './App.vue' | ||
import BootstrapVue from 'bootstrap-vue' | ||
import VueCookies from 'vue-cookies' | ||
import axios from 'axios' | ||
import router from '../router' | ||
|
||
import 'bootstrap/dist/css/bootstrap.css' | ||
import 'bootstrap-vue/dist/bootstrap-vue.css' | ||
|
||
Vue.prototype.$http = axios | ||
|
||
Vue.config.productionTip = false | ||
Vue.use(BootstrapVue) | ||
Vue.use(VueCookies) | ||
|
||
new Vue({ | ||
router, | ||
render: h => h(App) | ||
}).$mount('#app') |
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,17 @@ | ||
import Vue from 'vue' | ||
import Router from 'vue-router' | ||
|
||
import HelloWorld from '@/components/HelloWorld' | ||
|
||
Vue.use(Router) | ||
|
||
export default new Router({ | ||
routes: [ | ||
{ | ||
path: '/helloworld', | ||
component: HelloWorld | ||
} | ||
], | ||
linkActiveClass: "active", | ||
mode: "history" | ||
}) |
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