Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use history mode instead of hash mode (remove hash from GUI URL) #997

Merged
merged 4 commits into from
Apr 8, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Redirect old hash URLs to correct ones
  • Loading branch information
jjnesbitt committed Apr 6, 2022
commit 07dc0f04554da7fb8cbd828aa847556821f7506d
16 changes: 15 additions & 1 deletion web/src/views/HomeView/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,25 @@
<script lang="ts">
import StatsBar from '@/views/HomeView/StatsBar.vue';
import DandisetSearchField from '@/components/DandisetSearchField.vue';
import { defineComponent } from '@vue/composition-api';
import { computed, defineComponent, watchEffect } from '@vue/composition-api';

export default defineComponent({
name: 'HomeView',
components: { StatsBar, DandisetSearchField },
setup(props, ctx) {
/**
* Redirect old hash URLS to the correct one. This is only done on
* the home page, since any URL with a hash will default to here.
*/
const currentRoute = computed(() => ctx.root.$route);
watchEffect(() => {
const router = ctx.root.$router;
if (currentRoute.value.hash) {
const trimmed = router.currentRoute.hash.replace('#', '');
router.replace(trimmed);
}
});
},
});
</script>

Expand Down