backend/app/FakeResponse.js

53 lines
996 B
JavaScript
Raw Normal View History

2020-10-29 03:55:04 +00:00
const { Injectable } = require('flitter-di')
class FakeResponse extends Injectable {
_message = 'OK'
_status = 200
_api_data = undefined
_send_data = undefined
_view = undefined
_view_data = undefined
status(set = undefined) {
if ( set ) {
this._status = set
return this
} else {
return this._status
}
}
message(set = undefined) {
if ( set ) {
this._message = set
return this
} else {
return this._message
}
}
api(data = {}) {
this._api_data = data
return this
}
send(data = '') {
this._send_data = ''
return this
}
view(name, data = {}) {
this._view = name
this._view_data = data
return this
}
page(name, data = {}) {
this._view = name
this._view_data = data
return this
}
}
module.exports = exports = FakeResponse