user.js 1.14 KB
import request from '@/utils/request'
import {
  Notification
} from 'element-ui'
// login
export function login(data) {
  return request({
    url: '/yp/user/login',
    method: 'post',
    data
  })
}

// getInfo
export function getInfo(token) {
  return request({
    url: '/yp/user/info',
    method: 'get',
    params: { token }
  })
}

// logout
export function logout() {
  return request({
    url: '/yp/user/logout',
    method: 'post'
  })
}

// fetchList
export function fetchList(query) {
  const options = {
    type: 'error',
    message: query,
    title: '==query value ===',
    showClose: true,
    duration: 4000
  }
  Notification(options)
  return request({
    url: '/yp/user/list',
    method: 'get',
    params: query
  })
}

// createUser
export function createUser(query) {
  return request({
    url: '/yp/user/create',
    method: 'post',
    params: query
  })
}

// updateUser
export function updateUser(query) {
  return request({
    url: '/yp/user/update',
    method: 'post',
    params: query
  })
}

// delUser
export function delUser(query) {
  return request({
    url: '/yp/user/del',
    method: 'post',
    params: query
  })
}