// Jobs Store
import { Connect, mix } from 'fronto-connect'
import scopes from './scopes'
class Jobs extends Connect {
namespace = 'v1'
resource = 'jobs'
constructor(api, namespace = null) {
super(api, namespace)
}
updateStatus(parameters, body) {
this.setIsLoading(true)
this.call({ parameters, body, type: 'patch', query: true}, {
200: (response) => {
this.setSelected(response.data);
if (callback) callback()
},
});
}
}
mix(Jobs, scopes.readable)
mix(Jobs, scopes.writeable)
export default Jobs
// Function call
updateStatus = (e) => {
const { jobs, job } = this.props
jobs.updateStatus({id: job.id, update_status: true}, this.closeModal);
}
The Job store shows the updateStatus function declaration
The function calls shows how I am calling the updateStatus function
The function calls shows how I am calling the updateStatus function
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.