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
Ayush Sharma e03672b70b Chore: typo and spacing fixes
test name fixes
2018-01-07 07:59:36 +00:00

26 lines
551 B
JavaScript

/**
* API mock for login endpoint
* @param {object} config configuration of api call
* @returns {promise}
*/
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' }
}
});
}
});
}