Skip to content

Commit 7f29cac

Browse files
committed
Resolve misc issues
1 parent 581bea0 commit 7f29cac

File tree

5 files changed

+61
-48
lines changed

5 files changed

+61
-48
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/gin-gonic/gin v1.6.3
99
github.com/go-playground/validator/v10 v10.4.1 // indirect
1010
github.com/golang/protobuf v1.4.3 // indirect
11-
github.com/google/uuid v1.2.0 // indirect
11+
github.com/google/uuid v1.2.0
1212
github.com/gorilla/sessions v1.2.1 // indirect
1313
github.com/json-iterator/go v1.1.10 // indirect
1414
github.com/leodido/go-urn v1.2.1 // indirect

src/App.vue

Lines changed: 44 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,50 +14,57 @@
1414

1515
<v-divider></v-divider>
1616

17+
1718
<v-list dense nav mini>
18-
<v-list-item link>
19-
<v-list-item-icon>
20-
<v-icon>mdi-account-question</v-icon>
21-
</v-list-item-icon>
22-
<v-list-item-content>
23-
<router-link to="/factoids">Factoids</router-link>
24-
</v-list-item-content>
25-
</v-list-item>
19+
<router-link to="/factoids" tag="div">
20+
<v-list-item link>
21+
<v-list-item-icon>
22+
<v-icon>mdi-account-question</v-icon>
23+
</v-list-item-icon>
24+
<v-list-item-content>
25+
<span>Factoids</span>
26+
</v-list-item-content>
27+
</v-list-item>
28+
</router-link>
2629

27-
<v-list-item link>
28-
<v-list-item-icon>
29-
<v-icon>mdi-bug</v-icon>
30-
</v-list-item-icon>
31-
<v-list-item-content>
32-
<router-link to="/hjt">HJT</router-link>
33-
</v-list-item-content>
34-
</v-list-item>
30+
<router-link to="/hjt" tag="div">
31+
<v-list-item link>
32+
<v-list-item-icon>
33+
<v-icon>mdi-bug</v-icon>
34+
</v-list-item-icon>
35+
<v-list-item-content>
36+
<span>HJT</span>
37+
</v-list-item-content>
38+
</v-list-item>
39+
</router-link>
3540

36-
<v-list-item link v-if="canEditUsers">
37-
<v-list-item-icon>
38-
<v-icon>mdi-account-group</v-icon>
39-
</v-list-item-icon>
40-
<v-list-item-content>
41-
<router-link to="/users">Users</router-link>
42-
</v-list-item-content>
43-
</v-list-item>
41+
<router-link to="/users" tag="div" v-if="canEditUsers">
42+
<v-list-item link>
43+
<v-list-item-icon>
44+
<v-icon>mdi-account-group</v-icon>
45+
</v-list-item-icon>
46+
<v-list-item-content>
47+
<span>Users</span>
48+
</v-list-item-content>
49+
</v-list-item>
50+
</router-link>
4451

4552
<v-divider></v-divider>
4653

47-
<v-list-item link v-if="loggedIn">
54+
<v-list-item link v-if="loggedIn" v-on:click="logout">
4855
<v-list-item-icon>
4956
<v-icon>mdi-account-arrow-right</v-icon>
5057
</v-list-item-icon>
5158
<v-list-item-content>
52-
<a href="#" v-on:click="logout">Logout</a>
59+
<span>Logout</span>
5360
</v-list-item-content>
5461
</v-list-item>
55-
<v-list-item link v-else>
62+
<v-list-item link v-else v-on:click="login">
5663
<v-list-item-icon>
5764
<v-icon>mdi-account-arrow-right</v-icon>
5865
</v-list-item-icon>
5966
<v-list-item-content>
60-
<a href="/login">Login</a>
67+
<span>Login</span>
6168
</v-list-item-content>
6269
</v-list-item>
6370
</v-list>
@@ -92,7 +99,7 @@
9299
import axios from "axios";
93100
94101
export default {
95-
data () {
102+
data() {
96103
return {
97104
canEditUsers: false,
98105
loggedIn: false
@@ -105,24 +112,27 @@ export default {
105112
}
106113
},
107114
mounted() {
108-
if (this.$cookies.get("perms").split("+").includes("user.manage")) {
115+
if (this.$cookies.get("perms")?.split("+").includes("user.manage")) {
109116
this.canEditUsers = true;
110117
}
111-
if (this.$cookies.get("perms")) {
118+
if (this.$cookies.get("panelsession")) {
112119
this.loggedIn = true
113120
}
114121
},
115122
methods: {
116-
toggleTheme: function() {
117-
localStorage.setItem("dark-theme", !this.$vuetify.theme.dark ? "dark": "light");
123+
toggleTheme: function () {
124+
localStorage.setItem("dark-theme", !this.$vuetify.theme.dark ? "dark" : "light");
118125
this.$vuetify.theme.dark = !this.$vuetify.theme.dark;
119126
},
120-
logout: function() {
127+
logout: function () {
121128
axios.post('/logout').then(() => {
122129
this.loggedIn = false
123130
this.$cookies.remove("perms")
124131
this.$cookies.remove("panelsession")
125132
})
133+
},
134+
login: function () {
135+
window.location.href = "/login";
126136
}
127137
}
128138
}

src/views/Factoids.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export default {
104104
},
105105
mounted () {
106106
this.getFactoids();
107-
if (this.$cookies.get("perms").split("+").includes("factoid.manage")) {
107+
if (this.$cookies.get("perms")?.split("+").includes("factoid.manage")) {
108108
this.canEdit = true;
109109
}
110110
},

src/views/HJT.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export default {
121121
},
122122
mounted() {
123123
this.getHJTs();
124-
if (this.$cookies.get("perms").split("+").includes("hjt.manage")) {
124+
if (this.$cookies.get("perms")?.split("+").includes("hjt.manage")) {
125125
this.canEdit = true;
126126
}
127127
},

src/views/Users.vue

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
@input="searchDiscord"
88
></v-text-field>
99

10-
<v-card v-if="discordId.length === 18" :loading="searching">
10+
<v-card v-if="searching || hasRecord" :loading="searching">
1111
<template slot="progress">
1212
<v-progress-linear
1313
color="deep-purple"
@@ -77,16 +77,19 @@ export default {
7777
}
7878
},
7979
searchDiscord: function() {
80-
if (this.discordId.length === 18) {
81-
axios.get('/api/flags/' + this.discordId).then((e) => {
82-
this.searching = false
83-
this.hasRecord = true
84-
this.discordUser = e.data
85-
}).catch((e) => {
86-
this.error = e.data.message
87-
this.searching = false
88-
});
89-
}
80+
axios.get('/api/flags/' + this.discordId).then((e) => {
81+
this.searching = false
82+
this.hasRecord = true
83+
this.discordUser = e.data
84+
}).catch((e) => {
85+
this.error = e.data.message
86+
this.searching = false
87+
this.hasRecord = false;
88+
this.discordUser = {
89+
user: {},
90+
perms: []
91+
};
92+
});
9093
},
9194
save: function() {
9295
this.searching = true

0 commit comments

Comments
 (0)