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

feat: private session data #65

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Gerbuuun
Copy link
Contributor

@Gerbuuun Gerbuuun commented Mar 11, 2024

I have added a public object to the SessionData which still contains the User type like before.
The setUserSession and replaceUserSession have the parameters as described in #47

The SessionData type is no longer exposed in favor of PublicSessionData and PrivateSessionData.
(only used internally from now on)

I'm not really sure about this solution yet.
What I'm thinking is to let go of the user property as a session check and instead just use public like user is used right now. There won't be a built in computed user but this can easily be added by wrapping the useUserSession:

export default function userStore() {
  const { session, clear, fetch, loggedIn } = useUserSession();

  const user = computed(() => session.value.user || null);

  return {
    user,
    session,
    clear,
    fetch,
    loggedIn
  };
}

This way you don't have to use user and can add anything you want (as long as there is something)
Problem is.. useUserSession is already taken as composable name

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

Successfully merging this pull request may close these issues.

None yet

1 participant