This commit is contained in:
Troplo 2021-04-09 19:59:33 +10:00
parent 1f49dee177
commit 406764ea12
5 changed files with 32 additions and 46 deletions

View File

@ -20,34 +20,28 @@ export default {
Footer,
},
mounted() {
const jwt = JSON.parse(localStorage.getItem("token"));
const wind = JSON.parse(localStorage.getItem("wind404"));
if (jwt) {
this.$store.commit("setToken", jwt);
if (JSON.parse(localStorage.getItem("token"))) {
this.$store.commit("setToken", JSON.parse(localStorage.getItem("token")));
}
if (JSON.parse(localStorage.getItem("wind404"))) {
var wind = JSON.parse(localStorage.getItem("wind404"));
} else {
// eslint-disable-next-line no-redeclare
var wind = false;
}
this.$store.commit("setWind", wind);
Object.assign(axios.defaults, {
headers: { Authorization: this.$store.state.user.token },
});
if (wind) {
this.$store.commit("setWind", wind);
} else {
this.$store.commit("setWind", wind);
}
if (this.$store.state.debug) {
this.$buefy.snackbar.open({
message: this.$t("errors.devBuild"),
type: "is-warning",
});
}
if (this.$store.state.user.username) {
this.axios
this.axios
.get(
process.env.VUE_APP_APIENDPOINT +
process.env.VUE_APP_APIENDPOINT +
process.env.VUE_APP_APIVERSION +
"/" +
"userinfo"
@ -63,20 +57,14 @@ export default {
this.$store.commit("setDescription", res.data.description);
this.$store.commit("setExecutive", res.data.executive);
})
.catch(() => {
this.$buefy.snackbar.open({
message: this.$t("errors.down"),
type: "is-warning",
});
});
if (this.$store.state.user.username) {
this.axios.get(
process.env.VUE_APP_APIENDPOINT +
process.env.VUE_APP_APIENDPOINT +
process.env.VUE_APP_APIVERSION +
"/" +
"awards/eligibility"
);
}
)
}
},
};
</script>

View File

@ -45,7 +45,8 @@
<b-tag v-if="system" class="is-success" rounded>{{ $t('badges.system') }}</b-tag>&nbsp;
<b-tag v-if="hidden" rounded>{{ $t('badges.hidden') }}</b-tag>&nbsp;
<b-tag v-if="verified" rounded><i class="fas fa-check"></i>&nbsp;Verified</b-tag>
<b-button @click="modal()" v-if="$store.state.user.admin & !noPlus" class="is-info tag" rounded><i class="fas fa-plus"></i></b-button>
<b-button @click="modal(user)" v-if="$store.state.user.admin & user" class="is-info tag" rounded><i class="fas fa-plus"></i></b-button>
<b-button @click="modal(team)" v-if="$store.state.user.admin & team" class="is-info tag" rounded><i class="fas fa-plus"></i></b-button>
</span>
</template>
<script>
@ -53,15 +54,21 @@ import AjaxErrorHandler from ".././assets/js/errorHandler";
export default {
name: 'UserBadges',
props: ['admin', 'booster', 'bot', 'hidden', 'banned', 'system', 'username', 'noPlus', 'verified'],
props: ['admin', 'booster', 'bot', 'hidden', 'banned', 'system', 'username', 'user', 'verified', 'team'],
data() {
return {
modifyUserModal: false
}
},
methods: {
modal() {
this.modifyUserModal = true
modal(type) {
if(type === 'user') {
this.modifyUserModal = true
} else if(type === 'team') {
console.log('Debug: Feature not implemented')
} else {
this.modifyUserModal = true
}
},
modifyUser() {
this.axios

View File

@ -32,6 +32,8 @@ Vue.use(Buefy);
Vue.config.productionTip = false;
Vue.prototype.$snackbar = Snackbar;
axios.defaults.headers.common["Authorization"] = localStorage.getItem("token")
// BBCode Configuration
VMdEditor.lang.use("en-US", enUS);
hljsTheme.extend((md, hljs) => {

View File

@ -23,23 +23,11 @@
>
<div class="box">
<h1 class="title">
{{ user.username }}&nbsp;<Badges
:verified="user.verified"
<router-link :to="'/t/' + user.username" style="text-decoration: none; color: inherit;">{{ user.username }}</router-link>&nbsp;<Badges
:verified="user.verified" :team="true"
></Badges>
</h1>
<img
:src="
'https://cdn.kaverti.com/user/avatars/full/' +
user.picture +
'.png'
"
/><br />
<b-button
tag="router-link"
:to="'/u/' + user.username"
class="is-centered is-info"
>View Team</b-button
>
PLACEHOLDER IMAGE<br />
</div>
</div>
</Pagination>

View File

@ -30,6 +30,7 @@
:admin="user.admin"
:booster="user.booster"
:bot="user.bot"
:user="true"
></Badges>
</h1>
<img