Jump to content
McKay Development

Dyceman

Member
  • Posts

    6
  • Joined

  • Last visited

Posts posted by Dyceman

  1. I created a work around until I get a reply. If anyone else is running into this issue then use the below code.

    community.getNotifications(function(err, notifications) // Used to check if the user is logged in.
    	{
    		if(err.toString().indexOf("HTTP error 401") > -1)
    		{
    			console.log("Saved Announcement");
    			announcements.push({title: title, body: body});
    			client.webLogOn();
    		}
    		else
    		{
    			community.postGroupAnnouncement(config.steam_group_id, title, body, function(err) // Doesn't check if the user is logged in...... -.-
    			{
    
    
    				if(err != null)
    				{
    					console.log(err);
    					response.status(500).send("An error has occured, check your console.");
    				}
    				else
    				{
    					console.log("Posted Announcement Successfully!");
    					response.status(200).send("Posted Announcement Successfully!");
    				}
    			});
    		}
    	});
    
  2. The postGroupAnnouncement doesn't trigger sessionExpired if the session is expired because the err object never displays the "Not Logged In" error.

     

    Because of the this issue mentioned above you can't post announcements or log back in from the postGroupAnnoucement.

     

    Is there a way around this issue?

     

     

    My code.

    community.postGroupAnnouncement(config.steam_group_id, title, body, function(err)
    	{
    
    		console.log(err); // Displays null if the session is expired.
    
    		if(err != null)
    		{
    			if(err.toString().indexOf("Not Logged In") > -1) // Never is triggered.
    			{
    				console.log("Saved Announcement");
    				announcements.push({title: title, body: body});
    			}
    			else
    			{
    				console.log(err);
    				response.status(500).send("An error has occured, check your console.");
    			}
    			
    		}
    		else
    		{
    			console.log("Posted Announcement Successfully!");
    			response.status(200).send("Posted Announcement Successfully!");
    		}
    	});
    
×
×
  • Create New...