File tree Expand file tree Collapse file tree 1 file changed +24
-4
lines changed Expand file tree Collapse file tree 1 file changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -166,22 +166,42 @@ export default class Version extends Model {
166166 }
167167
168168 yankTask = keepLatestTask ( async ( ) => {
169- let response = await fetch ( `/api/v1/crates/${ this . crate . id } /${ this . num } /yank` , { method : 'DELETE' } ) ;
169+ let response = await fetch ( `/api/v1/crates/${ this . crate . id } /${ this . num } ` , {
170+ method : 'PATCH' ,
171+ headers : {
172+ 'Content-Type' : 'application/json' ,
173+ } ,
174+ body : JSON . stringify ( {
175+ version : {
176+ yanked : true ,
177+ } ,
178+ } ) ,
179+ } ) ;
170180 if ( ! response . ok ) {
171181 throw new Error ( `Yank request for ${ this . crateName } v${ this . num } failed` ) ;
172182 }
173183 this . set ( 'yanked' , true ) ;
174184
175- return await response . text ( ) ;
185+ return await response . json ( ) ;
176186 } ) ;
177187
178188 unyankTask = keepLatestTask ( async ( ) => {
179- let response = await fetch ( `/api/v1/crates/${ this . crate . id } /${ this . num } /unyank` , { method : 'PUT' } ) ;
189+ let response = await fetch ( `/api/v1/crates/${ this . crate . id } /${ this . num } ` , {
190+ method : 'PATCH' ,
191+ headers : {
192+ 'Content-Type' : 'application/json' ,
193+ } ,
194+ body : JSON . stringify ( {
195+ version : {
196+ yanked : false ,
197+ } ,
198+ } ) ,
199+ } ) ;
180200 if ( ! response . ok ) {
181201 throw new Error ( `Unyank request for ${ this . crateName } v${ this . num } failed` ) ;
182202 }
183203 this . set ( 'yanked' , false ) ;
184204
185- return await response . text ( ) ;
205+ return await response . json ( ) ;
186206 } ) ;
187207}
You can’t perform that action at this time.
0 commit comments