Skip to content

Commit 02963c5

Browse files
authored
fix: routing issue after rename (#201)
1 parent 7f5c7a5 commit 02963c5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/file/Rename.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { defineProps, inject, ref } from "vue";
33
import { decodeString, encodeString, useLoader } from "@/helpers/index.js";
44
import { createAndUpdateFile, deleteFileBySHA } from "@/api/index.js";
55
import { BASE_PATH } from "@/enums";
6+
import { useRouter } from "vue-router";
67
78
const props = defineProps({
89
file: {
@@ -23,6 +24,8 @@ const props = defineProps({
2324
},
2425
});
2526
const snackbar = inject("set-snackbar");
27+
const router = useRouter();
28+
2629
const renameFile = ref(null);
2730
const renameFileTitle = ref(props.file.name);
2831
const confirmRename = ref(false);
@@ -63,7 +66,7 @@ const renameFileHandle = async () => {
6366
confirmRename.value = false;
6467
6568
if (snackbar.value.status === "success") {
66-
window.location.href = `${BASE_PATH}${props.session.number}/${encodeString(newPath)}`;
69+
router.push(`/${props.session.number}/${encodeString(newPath)}`);
6770
}
6871
}
6972
}

0 commit comments

Comments
 (0)