Continue Upload Script.

Pause during rewrite of RHPZ Server code.
This commit is contained in:
2026-01-29 18:49:47 +01:00
parent f029371a68
commit f34019c802
9 changed files with 210 additions and 7 deletions

View File

@@ -14,5 +14,41 @@ export class Reserve_Post_ID {
callback();
return;
}
if( I.custom_post_type === undefined || I.custom_post_type === "unknown" ){
console.error( "The custom post type is missing" );
return;
}
this.do_request( callback );
}
private do_request( callback: () => any ){
jQuery.ajax({
type: "POST",
url: _romhackplaza_script_uploader.submit_url,
data: {
action: "reserve_post_id",
custom_post_type: I.custom_post_type,
_wpnonce: _romhackplaza_script_uploader.reserve_nonce
},
success: function( response: any ) {
if( response.success ) {
I.reserved_post_id = response.data.post_id;
jQuery( "#reservedPostID" ).val( I.reserved_post_id );
callback();
} else {
romhackplaza_manage_modal( romhackplaza_modal_submissions, "block", __( "Submit error", 'romhackplaza' ), __( "Could not reserve a post ID. Please refresh the page.", "romhackplaza" ), "" );
}
},
error: function( response: any ) {
romhackplaza_manage_modal( romhackplaza_modal_submissions, "block", __( "Submit error", 'romhackplaza' ), __( "Error occurred while reserving a post ID. Please refresh the page.", "romhackplaza" ), "" );
}
});
}
}