sbox-issues icon indicating copy to clipboard operation
sbox-issues copied to clipboard

[ActionGraph] Get Cookies

Open badandbest opened this issue 1 year ago • 0 comments

For?

Other

What can't you do?

No access to the cookie container in ActionGraph.

image

How would you like it to work?

In C# it's Cookie.Get<T>( "cookie", defaultValue );

Here's what it could look like (minus the fallback value) image

What have you tried?

I made my own.

public static class CookieHelper
{
	/// <summary>
	/// Gets a cookie value.
	/// </summary>
	[ActionGraphNode( "cookie.get" )]
	[Title( "Get {T}" ), Group( "Cookie" ), Icon("cookie")]
	public static T Get<T>( string key )
	{
		return Cookie.Get( key, (T)default );
	}
}

But I believe something as useful as Cookies should be in ActionGraph by default.

Additional context

No response

badandbest avatar Aug 17 '24 14:08 badandbest