@@ -24,6 +24,7 @@ import {initRepoPullRequestCommitStatus} from './repo-issue-pr-status.js';
2424import { hideElem , showElem } from '../utils/dom.js' ;
2525import { getComboMarkdownEditor , initComboMarkdownEditor } from './comp/ComboMarkdownEditor.js' ;
2626import { attachRefIssueContextPopup } from './contextpopup.js' ;
27+ import { POST } from '../modules/fetch.js' ;
2728
2829const { csrfToken} = window . config ;
2930
@@ -65,7 +66,7 @@ export function initRepoCommentForm() {
6566 const $selectBranch = $ ( '.ui.select-branch' ) ;
6667 const $branchMenu = $selectBranch . find ( '.reference-list-menu' ) ;
6768 const $isNewIssue = $branchMenu . hasClass ( 'new-issue' ) ;
68- $branchMenu . find ( '.item:not(.no-select)' ) . on ( 'click' , function ( ) {
69+ $branchMenu . find ( '.item:not(.no-select)' ) . on ( 'click' , async function ( ) {
6970 const selectedValue = $ ( this ) . data ( 'id' ) ;
7071 const editMode = $ ( '#editing_mode' ) . val ( ) ;
7172 $ ( $ ( this ) . data ( 'id-selector' ) ) . val ( selectedValue ) ;
@@ -76,7 +77,14 @@ export function initRepoCommentForm() {
7677
7778 if ( editMode === 'true' ) {
7879 const form = $ ( '#update_issueref_form' ) ;
79- $ . post ( form . attr ( 'action' ) , { _csrf : csrfToken , ref : selectedValue } , ( ) => window . location . reload ( ) ) ;
80+ const params = new URLSearchParams ( ) ;
81+ params . append ( 'ref' , selectedValue ) ;
82+ try {
83+ await POST ( form . attr ( 'action' ) , { data : params } ) ;
84+ window . location . reload ( ) ;
85+ } catch ( error ) {
86+ console . error ( 'Error:' , error ) ;
87+ }
8088 } else if ( editMode === '' ) {
8189 $selectBranch . find ( '.ui .branch-name' ) . text ( selectedValue ) ;
8290 }
0 commit comments