2019-03-08 17:54:45 +01:00
|
|
|
const createRq = require('./request');
|
2018-07-19 14:46:03 +02:00
|
|
|
|
|
|
|
const auth = {
|
|
|
|
username: 'admin',
|
|
|
|
email: 'admin@strapi.io',
|
2019-03-08 17:54:45 +01:00
|
|
|
password: 'pcw123',
|
2018-07-19 14:46:03 +02:00
|
|
|
};
|
|
|
|
|
2019-03-08 17:54:45 +01:00
|
|
|
const rq = createRq();
|
|
|
|
|
2018-07-19 14:46:03 +02:00
|
|
|
module.exports = {
|
|
|
|
auth,
|
|
|
|
login: () => {
|
2019-03-08 17:54:45 +01:00
|
|
|
return new Promise(async resolve => {
|
|
|
|
const res = await rq({
|
|
|
|
url: '/auth/local',
|
2018-07-19 14:46:03 +02:00
|
|
|
method: 'POST',
|
|
|
|
body: {
|
|
|
|
identifier: auth.email,
|
2019-03-08 17:54:45 +01:00
|
|
|
password: auth.password,
|
2018-07-19 14:46:03 +02:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2019-03-08 17:54:45 +01:00
|
|
|
resolve(res.body);
|
2018-07-19 14:46:03 +02:00
|
|
|
});
|
2019-03-08 17:54:45 +01:00
|
|
|
},
|
2018-07-19 14:46:03 +02:00
|
|
|
};
|