File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -358,15 +358,7 @@ export default class Packages {
358358 * @param {PackageInstallationOption } [options]
359359 */
360360 uninstall ( name , options = { } ) {
361- return this . _apiRequest ( 'uninstall' , {
362- name,
363- options : createPackageInstallationOptions ( options )
364- } )
365- . then ( ( body ) => {
366- if ( body . reload ) {
367- this . init ( ) ;
368- }
369- } ) ;
361+ return this . _manageApiRequest ( 'uninstall' , options , { name} ) ;
370362 }
371363
372364 /**
@@ -375,10 +367,20 @@ export default class Packages {
375367 * @param {PackageInstallationOption } [options]
376368 */
377369 install ( url , options = { } ) {
378- return this . _apiRequest ( 'install' , {
379- url,
370+ return this . _manageApiRequest ( 'install' , options , { url} ) ;
371+ }
372+
373+ /**
374+ * Creates a new API request for package management
375+ * @param {string } endpoint
376+ * @param {object } body
377+ * @param {object } append
378+ * @return {object } JSON
379+ */
380+ _manageApiRequest ( endpoint , options , append ) {
381+ return this . _apiRequest ( endpoint , Object . assign ( {
380382 options : createPackageInstallationOptions ( options )
381- } )
383+ } , append ) )
382384 . then ( ( body ) => {
383385 if ( body . reload ) {
384386 this . init ( ) ;
You can’t perform that action at this time.
0 commit comments