mirror of
https://github.com/HangarMC/Hangar.git
synced 2025-02-23 15:12:52 +08:00
don't allow starring if not logged in
Signed-off-by: MiniDigger <admin@minidigger.me>
This commit is contained in:
parent
5e491821c0
commit
c65c6daa1d
@ -78,6 +78,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
watch() {
|
watch() {
|
||||||
|
if (!this.checkHasUser()) return;
|
||||||
this.value.watching = !this.value.watching;
|
this.value.watching = !this.value.watching;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'post',
|
type: 'post',
|
||||||
@ -85,6 +86,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
star() {
|
star() {
|
||||||
|
if (!this.checkHasUser()) return;
|
||||||
this.value.starCount += this.starIncrement;
|
this.value.starCount += this.starIncrement;
|
||||||
this.value.starred = this.starIncrement > 0;
|
this.value.starred = this.starIncrement > 0;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -93,6 +95,14 @@ export default {
|
|||||||
});
|
});
|
||||||
this.starIncrement *= -1;
|
this.starIncrement *= -1;
|
||||||
},
|
},
|
||||||
|
checkHasUser() {
|
||||||
|
if (!this.hasUser) {
|
||||||
|
// TODO some alert or modal?
|
||||||
|
alert("Please login first");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.value.starred = this.isStarred;
|
this.value.starred = this.isStarred;
|
||||||
|
Loading…
Reference in New Issue
Block a user