dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.59k stars 10.06k forks source link

Need `sessionStorage.getState`/`sessionStorage.setState` for doc example code #53575

Open guardrex opened 10 months ago

guardrex commented 10 months ago

Is there an existing issue for this?

Describe the bug

@javiercn ... This one needs your assistance.

On #53465, @shui106 reported that a WASM doc example for Save app state before an authentication operation with session storage was malformed. We had a PR come through from a reader that asked to set the FNs to getItem/setItem, but that was an incorrect change. I believe the original code example was correct.

The original code supplied for the doc came from ...

https://gist.github.com/javiercn/85a6d4ce46a78239ccb427baad3a66da#handling-token-request-errors

I don't see the FNs for sessionStorage.getState/sessionStorage.setState there. I think if I publish those FNs with the code example and switch the doc example code back to getState/setState that it will fix the problem.

Can you supply sessionStorage.getState/sessionStorage.setState FNs to go with your original code?

Expected Behavior

N/A

Steps To Reproduce

N/A

Exceptions (if any)

N/A

.NET Version

N/A

Anything else?

N/A

javiercn commented 10 months ago

@guardrex "getState" and "setState" seem to be a mistake. It's likely referring to "getItem" and "setItem".

https://developer.mozilla.org/en/docs/Web/API/Window/sessionStorage https://developer.mozilla.org/en/docs/Web/API/Storage/setItem https://developer.mozilla.org/en/docs/Web/API/Storage/getItem