login.js 545 B

1234567891011121314151617181920212223242526272829303132
  1. import { axios } from '@/utils/request'
  2. export function login(username, password) {
  3. return axios({
  4. url: '/auth/login',
  5. method: 'post',
  6. data: {
  7. username,
  8. password
  9. }
  10. })
  11. }
  12. export function getInfo() {
  13. return axios({
  14. url: '/user/info',
  15. method: 'get',
  16. headers: {
  17. 'Content-Type': 'application/json;charset=UTF-8'
  18. }
  19. })
  20. }
  21. export function logout() {
  22. return axios({
  23. url: '/auth/logout',
  24. method: 'post',
  25. headers: {
  26. 'Content-Type': 'application/json;charset=UTF-8'
  27. }
  28. })
  29. }