album: fix route after name edit

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/953/head
Varun Patil 2023-11-28 20:25:50 -08:00
parent 75d82bf2d2
commit 5f138698e0
1 changed files with 7 additions and 4 deletions

View File

@ -66,19 +66,22 @@ export default defineComponent({
this.show = false;
},
done({ album }: { album: { basename: string; filename: string } }) {
async done({ album }: { album: { basename: string; filename: string } }) {
// close modal first to pop fragments
await this.close();
// navigate to album if name changed
if (!this.album || album.basename !== this.album.basename) {
const user = album.filename.split('/')[2];
const name = album.basename;
const route = { name: 'albums', params: { user, name } };
if (!this.album) {
this.$router.push(route);
await this.$router.push(route);
} else {
this.$router.replace(route);
await this.$router.replace(route);
}
}
this.close();
},
},
});