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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow usage of the generated routes in SSR-enabled environments #260

Merged
merged 4 commits into from May 8, 2020

Conversation

emielmolenaar
Copy link
Contributor

I am using Ziggy in Nuxt.js, and the generated routes is causing errors on the server now because window isn't defined there. This commit should fix that 馃槂

@alfonsobries
Copy link

+1

@enzonotario
Copy link

Hi folks! Could you please tell me how are you using it with Nuxt?

Thanks in advance!

@emielmolenaar
Copy link
Contributor Author

emielmolenaar commented Feb 17, 2020

I have created a Nuxt plugin in plugins/ziggy.js with the following content:

import Vue from 'vue'
import route from '@/node_modules/ziggy/dist/js/route'
import { Ziggy } from '@/mixins/ziggy/routes'

Vue.mixin({
    methods: {
        route: (name, params, absolute) => route(name, params, absolute, Ziggy),
    }
});

Now you may generate a route by running this.route(name, params); in your Vue components. Be sure to add plugins/ziggy.js to your plugins array in nuxt.config.js.

@emielmolenaar
Copy link
Contributor Author

Can we merge this please?

@mattstauffer
Copy link
Member

@emielmolenaar Thanks for following up! Daniel, the maintainer, left Tighten and we've been a bit behind on taking over the maintenance responsibilities, because we've all been a bit slammed lately. But we're planning to triage issues and PRs and hopefully merge some PRs this week.

Thanks for your patience!

@emielmolenaar
Copy link
Contributor Author

Ah right thanks for the explanation. No worries, thanks!

@bakerkretzmar bakerkretzmar added the in progress We're working on it label May 2, 2020
@bakerkretzmar bakerkretzmar merged commit c77f169 into tighten:master May 8, 2020
@emielmolenaar
Copy link
Contributor Author

Awesome, thanks!

@bakerkretzmar
Copy link
Collaborator

Thanks for your patience! Hoping to tag a release including this later today.

@emielmolenaar
Copy link
Contributor Author

No problem! Thank you for your efforts in merging this PR. Cheers!

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

5 participants