"src/src/models" did not exist on "c017255fdf2b5b5ff436f46465d2650103ad532a"
Models.js 514 Bytes
Newer Older
Yoelvis Gonzalez's avatar
Yoelvis Gonzalez committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
export default class Models {
  static async login (axios, username, password) {
    const FormData = require('form-data')
    const data = new FormData()
    data.append('name', username)
    data.append('password', password)
    const response = await axios.post('/auth/login', data, {
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
      },
    })
    if (response.status === 200) {
      return response.data
    } else if (response.status === 403) {
      return -1
    }
  }
}