2021-02-22 16:46:07 +00:00
|
|
|
// Copyright (C) 2021 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="objects-area">
|
|
|
|
<div class="objects-area__header">
|
2021-02-24 22:53:57 +00:00
|
|
|
<h1 class="objects-area__header__title">Objects</h1>
|
2021-02-22 16:46:07 +00:00
|
|
|
</div>
|
|
|
|
<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;
|
2021-02-24 22:53:57 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
2021-02-22 16:46:07 +00:00
|
|
|
|
|
|
|
&__header {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
2021-02-24 22:53:57 +00:00
|
|
|
width: 100%;
|
2021-02-22 16:46:07 +00:00
|
|
|
|
|
|
|
&__title {
|
|
|
|
font-family: 'font_medium', sans-serif;
|
|
|
|
font-style: normal;
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: 18px;
|
|
|
|
line-height: 26px;
|
2021-02-24 22:53:57 +00:00
|
|
|
color: #232b34;
|
2021-02-22 16:46:07 +00:00
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|