mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-27 15:54:23 +02:00
[Ivan Diaz] - #8 - Change response to be function [skip ci]
This commit is contained in:
parent
3c56dbbcb7
commit
2aceef847c
@ -2,9 +2,25 @@ module.exports = [
|
|||||||
{
|
{
|
||||||
path: 'user/login',
|
path: 'user/login',
|
||||||
time: 1000,
|
time: 1000,
|
||||||
response: {
|
response: function (data) {
|
||||||
|
let response;
|
||||||
|
|
||||||
|
if (data.password === 'invalid') {
|
||||||
|
response = {
|
||||||
|
status: 'fail',
|
||||||
|
message: 'Invalid Credientals'
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
response = {
|
||||||
|
status: 'success',
|
||||||
|
data: {
|
||||||
'userId': 12,
|
'userId': 12,
|
||||||
'token': 'cc6b4921e6733d6aafe284ec0d7be57e'
|
'token': 'cc6b4921e6733d6aafe284ec0d7be57e'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
@ -7,9 +7,7 @@ let fixtures = (function () {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
add(fixtures) {
|
add(fixtures) {
|
||||||
fixtures.forEach((fixture) => {
|
fixturesData = fixturesData.concat(fixtures);
|
||||||
fixturesData.push(fixture);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
getAll() {
|
getAll() {
|
||||||
return fixturesData;
|
return fixturesData;
|
||||||
@ -25,6 +23,8 @@ _.each(fixtures.getAll(), function (fixture) {
|
|||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
url: 'http://localhost:3000/api/' + fixture.path,
|
url: 'http://localhost:3000/api/' + fixture.path,
|
||||||
responseTime: fixture.time || 500,
|
responseTime: fixture.time || 500,
|
||||||
responseText: fixture.response
|
response: function (settings) {
|
||||||
|
this.responseText = fixture.response(settings.data)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user