Skip to content

Commit 24b3572

Browse files
committed
Update: add information on Home
show username and random message on Home when login
1 parent ec4e4e4 commit 24b3572

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

static/assets/js/profile.js

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ const profile = new Vue({
1111
localStorage.removeItem('token')
1212
location.href = '/'
1313
},
14+
random_message() {
15+
const msg = [
16+
"Let's do our best today.",
17+
"Sometimes breaks are important.",
18+
"It's important to continue.",
19+
];
20+
return msg[Math.floor(Math.random() * msg.length)];
21+
},
1422
},
1523
created() {
1624
const date = new Date()

static/views/header.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
<link rel="manifest" href="/manifest.json"/>
88
<link rel="stylesheet" href="/assets/css/style.css" type="text/css" />
9-
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
9+
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
1010
<title>{{.Info.Title}}</title>
1111
{{end}}

static/views/profile.html

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
<body>
1313
<h1 class="title-h1">{{ .Info.Title }} - User Page</h1>
1414
<div id="profile">
15-
<div></div>
15+
<div>
16+
{{ `{{ user }}` }}, welcome!
17+
</div>
18+
<div>
19+
{{ `{{ random_message() }}` }}
20+
</div>
1621
<button type="button" name="logout" @click="logout()">logout</button>
1722
</div>
1823
<script src="assets/js/profile.js"></script>

0 commit comments

Comments
 (0)