const {post, config} = require('./promise.js');
const $ = require("jquery");
require('../images/rock.png')

$(function(){
  function getVersion() {
    post(config.getVersion, '').then((res) => {
      const data = res.data.data;
      const dtl = data.detail;
      const time = data.refreshTime.substr(0,10);
      let dom = '';
      $("h1 span").html(data.name);
      $(".time").html(time);
      for(let i=0;i<dtl.length;i++){
        dom += '<p>'+dtl[i].title+'</p><p>'+dtl[i].description+'</p>';
      }
      $(".content").html(dom);
    })
  }
  getVersion();
})