Skip to content

Commit

Permalink
Redirect anonymous users to home when importing public histories
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed May 31, 2024
1 parent 8dd7a9e commit 3c95ac0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/src/components/History/HistoryView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</div>

<b-alert :show="copySuccess">
History imported and is now your active history. <b-link to="/histories/list">View here</b-link>.
History imported and is now your active history. <b-link :to="importedHistoryLink">View here</b-link>.
</b-alert>

<CollectionPanel
Expand All @@ -49,6 +49,7 @@
<script>
import { mapActions, mapState } from "pinia";
import { isAnonymousUser } from "@/api";
import { useHistoryStore } from "@/stores/historyStore";
import { useUserStore } from "@/stores/userStore";
Expand Down Expand Up @@ -123,6 +124,9 @@ export default {
canImportHistory() {
return !this.userOwnsHistory && !this.history.purged;
},
importedHistoryLink() {
return isAnonymousUser(this.currentUser) ? "/" : "/histories/list";
},
},
created() {
this.loadHistoryById(this.id);
Expand Down

0 comments on commit 3c95ac0

Please sign in to comment.