wip: adds cache rich functionality
This commit is contained in:
30
assets/controllers/clear_cache_controller.js
Normal file
30
assets/controllers/clear_cache_controller.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Controller } from '@hotwired/stimulus';
|
||||
|
||||
/*
|
||||
* The following line makes this controller "lazy": it won't be downloaded until needed
|
||||
* See https://symfony.com/bundles/StimulusBundle/current/index.html#lazy-stimulus-controllers
|
||||
*/
|
||||
|
||||
/* stimulusFetch: 'lazy' */
|
||||
export default class extends Controller {
|
||||
initialize() {}
|
||||
|
||||
connect() {}
|
||||
|
||||
disconnect() {}
|
||||
|
||||
async clearAll() {
|
||||
let response = await fetch('/api/torrentio/cache', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
type: 'torrentio',
|
||||
mediaType: 'tvshows',
|
||||
})
|
||||
});
|
||||
response = await response.json()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user