File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import Axios from '../orm/axios' ;
12import Action from './Action'
3+ import Context from '../common/context'
24
35export default class Delete extends Action {
4- static call ( { state, dispatch } , params = { } ) {
5- console . log ( state , dispatch , params ) ;
6+ /**
7+ * Call $delete method
8+ * @param {object } store
9+ * @param {object } params
10+ */
11+ static async call ( { state, commit } , params = { } ) {
12+ const context = Context . getInstance ( ) ;
13+ const model = context . getModelFromState ( state ) ;
14+ const endpoint = Action . transformParams ( '$delete' , model , params ) ;
15+ const axios = new Axios ( model . methodConf . http ) ;
16+ const request = axios . delete ( endpoint ) ;
17+
18+ request
19+ . then ( data => {
20+ model . delete ( {
21+ where : ( params . params . id ) ? params . params . id : data . id ,
22+ } )
23+ } )
24+
25+ return request ;
626 }
727}
You can’t perform that action at this time.
0 commit comments