Skip to content

Middleware + pinia not working #15446

@maksimdrosdov

Description

@maksimdrosdov

Environment

middleware

Reproduction

middleware

Describe the bug

When I reload the page, it throws me to the authorization page, although the user is authorized

import { useAuthStore } from '~/store/auth';

export default defineNuxtRouteMiddleware(async () => {
  const { loggedIn } = useAuthStore();

  if (!loggedIn) {
    return navigateTo('/auth');
  }
});

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions