1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-13 03:35:52 +01:00
verdaccio/test/unit/webui/components/store/login.js

21 lines
492 B
JavaScript
Raw Normal View History

2017-12-01 20:04:01 +01:00
/**
* API mock for login endpoint
* @param {object} config configuration of api call
* @returns {promise}
2017-12-01 20:04:01 +01:00
*/
export default function(config) {
return new Promise((resolve, reject) => {
const body = JSON.parse(config.body);
if (body.username === 'sam' && body.password === '1234') {
resolve({
username: 'sam',
token: 'TEST_TOKEN'
});
2017-12-01 20:04:01 +01:00
} else {
reject({
error: 'bad username/password, access denied'
});
2017-12-01 20:04:01 +01:00
}
});
}