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

26 lines
551 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(function(resolve, reject) {
if (config.data.username === 'sam' && config.data.password === '1234') {
resolve({
status: 200,
data: {
username: 'sam',
token: 'TEST_TOKEN'
}
});
} else {
reject({
response: {
status: 401,
data: { error: 'Unauthorized' }
}
});
}
});
}