channel-switcher.js 594 B

123456789101112131415161718192021222324
  1. import $ from 'jquery';
  2. import request from '../utils/request';
  3. const switcher = $('input[type="radio"][name="channel-switch"]');
  4. if (switcher) {
  5. switcher.on('change', (event) => {
  6. let radio = $(event.target);
  7. let url = `${radio.parent('[data-url]').data('url')}`;
  8. request(url, {
  9. method: 'post',
  10. body: {
  11. task: 'gpmRelease',
  12. release: radio.val()
  13. }
  14. },
  15. (response) => {
  16. if (response.reload) {
  17. global.location.reload();
  18. }
  19. });
  20. });
  21. }