1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-17 07:45:52 +01:00
verdaccio/test/webui/components/store/login.js
2018-01-07 07:59:36 +00:00

24 lines
476 B
JavaScript

/**
* API mock for login endpoint
*/
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' }
}
});
}
});
}