Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Support SSR #50

Open
arunmenon1975 opened this issue Aug 31, 2020 · 2 comments
Open

Feature Request: Support SSR #50

arunmenon1975 opened this issue Aug 31, 2020 · 2 comments

Comments

@arunmenon1975
Copy link

I am integrating authlite into a new SSR project and found a few issues. I am currently working around them by directly editing the main.js file with the following changes:

if (typeof window === 'undefined') {
    global.window = {}
}

and

if (typeof window !== 'undefined') {
    ['set', 'get', 'remove'].forEach(m => (storageApi[m] = async (k, v) => localStorage[m + 'Item'](k, v)));
}

and

if (typeof window !== 'undefined') {
    this.storage.get(this.sKey('User')).then(user => {
....
}

So far, though i have just started, the above changes stops the immediate issues and am able to compile successfully. I think supporting SSR would help make the library much more versatile. It already does support react-native as well.

@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.85. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@samuelgozi
Copy link
Owner

Thanks for letting me know, Ill take a look and see what I can do about it. I want to avoid having x is undefined issues.
And sorry for the big delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants