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