Просмотр исходного кода

update GrowiZipImportSection state in componentWillMount

Yuki Takei 6 лет назад
Родитель
Сommit
c5f4718017
1 измененных файлов с 10 добавлено и 0 удалено
  1. 10 0
      src/client/js/components/Admin/ImportData/GrowiZipImportSection.jsx

+ 10 - 0
src/client/js/components/Admin/ImportData/GrowiZipImportSection.jsx

@@ -27,6 +27,16 @@ class GrowiZipImportSection extends React.Component {
     this.resetState = this.resetState.bind(this);
     this.resetState = this.resetState.bind(this);
   }
   }
 
 
+  async componentWillMount() {
+    // get uploaded file status
+    const res = await this.props.appContainer.apiv3Get('/import/status');
+
+    if (res.data.zipFileStat != null) {
+      const { fileName, innerFileStats } = res.data.zipFileStat;
+      this.setState({ fileName, innerFileStats });
+    }
+  }
+
   handleUpload({ meta, fileName, innerFileStats }) {
   handleUpload({ meta, fileName, innerFileStats }) {
     this.setState({
     this.setState({
       fileName,
       fileName,