import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DemoVO, DemoForm, DemoQuery } from '@/api/demo/demo/types';

/**
 * 查询首页logo
 * /system/logo/get
 */
export const getDemo = () => {
  return request({
    url: '/system/logo/get',
    method: 'get'
  });
};

/**
 * 上传图片
 * /system/logo/upload
 * @param file 文件对象
 */
export const uploadDemo = (file: File) => {
  const formData = new FormData();
  formData.append('file', file);

  return request({
    url: '/system/logo/upload',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
};

/**
 * 修改logo
 * /system/logo/edit
 * @param data
 */
export const updateDemo = (data: any) => {
  return request({
    url: '/system/logo/edit',
    method: 'post',
    data: data
  });
};
