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

Move solution slug checking logic to middleware #163

Closed
mlhaufe opened this issue Jun 22, 2024 · 1 comment · Fixed by #173 or #191
Closed

Move solution slug checking logic to middleware #163

mlhaufe opened this issue Jun 22, 2024 · 1 comment · Fixed by #173 or #191
Assignees
Milestone

Comments

@mlhaufe
Copy link
Contributor

mlhaufe commented Jun 22, 2024

Currently, nearly every page has the following pattern:

import SolutionRepository from '~/modules/solution/data/SolutionRepository';
import SolutionInteractor from '~/modules/solution/application/SolutionInteractor';

const router = useRouter(),
    route = useRoute(),
    slug = route.params.solutionSlug as string,
    solutionInteractor = new SolutionInteractor(new SolutionRepository()),
    solution = (await solutionInteractor.getAll({ slug }))[0];

if (!solution)
    router.push({ name: 'Solutions' })

Move this logic to middleware:

https://nuxt.com/docs/guide/directory-structure/middleware

@mlhaufe mlhaufe added this to the v0.8.0 milestone Jun 22, 2024
@mlhaufe mlhaufe self-assigned this Jun 25, 2024
@mlhaufe mlhaufe linked a pull request Jun 25, 2024 that will close this issue
@mlhaufe
Copy link
Contributor Author

mlhaufe commented Jun 28, 2024

Still not working.

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 a pull request may close this issue.

1 participant