2021-02-22 16:46:07 +00:00
|
|
|
// Copyright (C) 2021 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="objects-area">
|
|
|
|
<router-view/>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Vue } from 'vue-property-decorator';
|
|
|
|
|
2021-02-24 22:53:57 +00:00
|
|
|
import { RouteConfig } from '@/router';
|
2021-02-24 23:56:25 +00:00
|
|
|
import { LocalData, UserIDPassSalt } from '@/utils/localData';
|
2021-02-24 22:53:57 +00:00
|
|
|
|
2021-02-22 16:46:07 +00:00
|
|
|
@Component
|
2021-02-24 22:53:57 +00:00
|
|
|
export default class ObjectsArea extends Vue {
|
|
|
|
/**
|
|
|
|
* Lifecycle hook after initial render.
|
|
|
|
* Chooses correct route.
|
|
|
|
*/
|
2021-02-24 23:56:25 +00:00
|
|
|
public async mounted(): Promise<void> {
|
|
|
|
const DUPLICATE_NAV_ERROR: string = 'NavigationDuplicated';
|
|
|
|
const idPassSalt: UserIDPassSalt | null = LocalData.getUserIDPassSalt();
|
|
|
|
if (idPassSalt && idPassSalt.userId === this.$store.getters.user.id) {
|
|
|
|
try {
|
|
|
|
await this.$router.push(RouteConfig.Objects.with(RouteConfig.EnterPassphrase).path);
|
|
|
|
|
|
|
|
return;
|
|
|
|
} catch (error) {
|
|
|
|
if (error.name === DUPLICATE_NAV_ERROR) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
await this.$notify.error(error.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
await this.$router.push(RouteConfig.Objects.with(RouteConfig.CreatePassphrase).path);
|
|
|
|
} catch (error) {
|
|
|
|
if (error.name === DUPLICATE_NAV_ERROR) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
await this.$notify.error(error.message);
|
|
|
|
}
|
2021-02-24 22:53:57 +00:00
|
|
|
}
|
|
|
|
}
|
2021-02-22 16:46:07 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.objects-area {
|
|
|
|
padding: 20px 45px;
|
|
|
|
}
|
|
|
|
</style>
|