/* --- A place where you can add your own code -- */


function deleteuser() {
	 var formData = new FormData();
        formData.append("token", auth.currentUser.token);
        formData.append("uid", auth.currentUser.uid);
        var url = thoriumCorePlugin.httpRoot + kApiRoot + "thorium.auth.delete.php";
        fetch(url, {
            method: 'post',
            body: formData,
            contentType: 'multipart/form-data',
        })
        .then(thoriumapi.status)
        .then(thoriumapi.json)
        .then(function (data) {
 				if ((data) && (data.code < 0)) {
                    app.preloader.hide();
                    app.dialog.alert(data.message);
                } else {
					//Account Succesfully Deleted ,
					auth.logout();
				}
 		}).catch(function (error) {
                thoriumapi.logEvent(2, "[com.thoriumbuilder.dbexpress.data] Request failed " + error);
                app.preloader.hide();
                app.dialog.alert(error.message);
        });
}



$(document).on("click", "#button-1117", function(e) {
	e.preventDefault();
    app.dialog.confirm('Delete your Account?', function () {
		deleteuser();
	});
});

