refactor(editor): Migrate ErrorView component to Vue 3 (no-changelog) (#9740)

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
oleg 2024-06-14 10:37:52 +02:00 committed by GitHub
parent c8f0029bc5
commit d62ca78a4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,34 +17,22 @@
</div>
</template>
<script lang="ts">
<script setup lang="ts">
import type { BaseTextKey } from '@/plugins/i18n';
import { type PropType, defineComponent } from 'vue';
import { useRouter } from 'vue-router';
import { VIEWS } from '@/constants';
const router = useRouter();
export default defineComponent({
name: 'ErrorView',
props: {
messageKey: {
type: String as PropType<BaseTextKey>,
required: true,
},
errorCode: {
type: Number,
},
redirectTextKey: {
type: String as PropType<BaseTextKey>,
required: true,
},
redirectPage: {
type: String,
},
},
methods: {
onButtonClick() {
void this.$router.push({ name: this.redirectPage });
},
},
});
const props = defineProps<{
messageKey: BaseTextKey;
errorCode: number;
redirectTextKey: BaseTextKey;
redirectPage?: keyof typeof VIEWS;
}>();
function onButtonClick() {
void router.push({ name: props.redirectPage ?? VIEWS.HOMEPAGE });
}
</script>
<style lang="scss" module>