Cannor ready get() of undefined(csrf.get())


  • GNU/Linux

    When i delete an account I must redirect him to another page create from me and do logout. t I use this to resolve my problem and first it work but now it doesn't work.

    require(['csrf'], function(csrf) {
    										$.ajax(config.relative_path + '/logout', {
    											type: 'POST',
    											headers: {
    												'x-csrf-token': csrf.get()
    											},
    											success: function() {
    								window.location.href = config.relative_path + '/client/pagina-utente-cancellato';
    											}
    										});
    									});
    

    Now when I change versione this method doesn't work anymore. Anyone can explain why?


  • Admin

    Use config.csrf_token instead of the requirejs module


  • GNU/Linux

    @baris can you show me the correct code please? I don't understand how I can modify my code


  • Admin

    $.ajax(config.relative_path + '/logout', {
    	type: 'POST',
    	headers: {
    		'x-csrf-token': config.csrf_token
    	},
    	success: function() {
    		window.location.href = config.relative_path + '/client/pagina-utente-cancellato';
    	}
    });
    

  • GNU/Linux

    @baris It works thank for your support!


Log in to reply
 

Looks like your connection to NodeBB was lost, please wait while we try to reconnect.