diff --git a/src/components/grewSearch/GrewSearch.vue b/src/components/grewSearch/GrewSearch.vue index 76b2a973..4ad88c03 100644 --- a/src/components/grewSearch/GrewSearch.vue +++ b/src/components/grewSearch/GrewSearch.vue @@ -18,6 +18,7 @@ import { mapActions, mapState } from 'pinia'; import { grewSearchResult_t, sample_t } from 'src/api/backend-types'; import { useGrewHistoryStore } from 'src/pinia/modules/grewHistory'; import { useProjectStore } from 'src/pinia/modules/project'; +import { useUserStore } from 'src/pinia/modules/user'; import { notifyError } from 'src/utils/notify'; import { PropType, defineComponent } from 'vue'; @@ -63,6 +64,7 @@ export default defineComponent({ }, computed: { ...mapState(useProjectStore, ['name']), + ...mapState(useUserStore, ['isLoggedIn']), }, methods: { ...mapActions(useGrewHistoryStore, ['saveHistory']), @@ -76,7 +78,7 @@ export default defineComponent({ .searchRequest(this.name, data) .then((response) => { this.resultSearch = response.data; - this.saveSearchRequest(searchPattern); + if (this.isLoggedIn) this.saveSearchRequest(searchPattern); this.resultSearchDialog = true; }) .catch((error) => { diff --git a/src/components/grewSearch/ResultView.vue b/src/components/grewSearch/ResultView.vue index 1df0503f..3495c57b 100644 --- a/src/components/grewSearch/ResultView.vue +++ b/src/components/grewSearch/ResultView.vue @@ -156,7 +156,7 @@ export default defineComponent({ computed: { ...mapState(useProjectStore, ['name', 'canSaveTreeInProject', 'isValidator']), ...mapState(useGrewSearchStore, ['canRewriteRule']), - ...mapState(useUserStore, ['username']), + ...mapState(useUserStore, ['username', 'isLoggedIn']), ...mapState(useTreesStore, ['pendingModifications']), ...mapWritableState(useGithubStore, ['reloadCommits']), projectName(): string { @@ -249,7 +249,7 @@ export default defineComponent({ const datasample = { data: this.searchResultsCopy }; api.applyRule(this.projectName, datasample).then(() => { this.reloadCommits += 1; - this.saveAppliedRule(); + if (this.isLoggedIn) this.saveAppliedRule(); notifyMessage({ message: `Rule applied (user "${this.username}" rewrote and saved "${this.toSaveCounter}" at once)` }); this.$emit('closed'); });