MCPcopy Create free account
hub / github.com/keepfool/vue-tutorials / opts

Function opts

06.Router/basic/js/vue-resource.js:1215–1253  ·  view source on GitHub ↗
(action, args)

Source from the content-addressed store, hash-verified

1213 }
1214
1215 function opts(action, args) {
1216
1217 var options = assign({}, action),
1218 params = {},
1219 body;
1220
1221 switch (args.length) {
1222
1223 case 2:
1224
1225 params = args[0];
1226 body = args[1];
1227
1228 break;
1229
1230 case 1:
1231
1232 if (/^(POST|PUT|PATCH)$/i.test(options.method)) {
1233 body = args[0];
1234 } else {
1235 params = args[0];
1236 }
1237
1238 break;
1239
1240 case 0:
1241
1242 break;
1243
1244 default:
1245
1246 throw 'Expected up to 4 arguments [params, body], got ' + args.length + ' arguments';
1247 }
1248
1249 options.body = body;
1250 options.params = assign({}, options.params, params);
1251
1252 return options;
1253 }
1254
1255 Resource.actions = {
1256

Callers 1

ResourceFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected