<script setup lang="ts">
  const store = useArticleStore();
  const content = ref(store.currentArticle.content);
  const title = ref(store.currentArticle.title);

  async function uploadArticle(data: { title: string; content: string }) {
    store.currentArticle.title = data.title;
    store.currentArticle.content = data.content;
    await store.addNewArticle();
    useRouter().back();
  }
</script>

<template>
  <ArticleEditor
    :base-content="content"
    :base-title="title"
    :save-button="'上传文章'"
    @article-edit-finish="uploadArticle"
  />
</template>

<style scoped lang="less"></style>
