Skip to main content

max / makenotwork

580 B · 10 lines History Blame Raw
1 document.getElementById('new-collection-form').addEventListener('htmx:after:request', function(evt) {
2 var status = evt.detail.ctx.response ? evt.detail.ctx.response.status : 0;
3 if (status >= 200 && status < 300) {
4 // `#library-collections`, this tab's own frame. The library strip is
5 // described (`6b24f2df` step 1), so `#tab-content` is the strip itself
6 // and refreshing into it would replace the whole strip with one panel.
7 htmx.ajax('GET', '/library/tabs/collections', { target: '#library-collections', swap: 'innerHTML' });
8 }
9 });
10