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

It would be cool if you can make this a nuxt module #14

Open
misbahansori opened this issue Oct 26, 2023 · 4 comments
Open

It would be cool if you can make this a nuxt module #14

misbahansori opened this issue Oct 26, 2023 · 4 comments

Comments

@misbahansori
Copy link

Hi, firstly I want to say thank you for this awesome repo. I have used this in my project and it works great. But when I want to create a new project with nuxt, I need to copy the code from this repo to my new project. It would be cool if someone could make this a nuxt module.

It would help a lot of people who want to use this in their nuxt project.

Thank you.

@amrnn90
Copy link
Owner

amrnn90 commented Oct 26, 2023

Hi @misbahansori,
You can already use this as a Nuxt Layer.
Add this to your existing Nuxt project's configuration:

// nuxt.config.ts

export default defineNuxtConfig({
  extends: ["github:amrnn90/breeze-nuxt#master"],
});

And make sure to add the dependencies of this repo to your own package.json and install them:

  "devDependencies": {
    "@nuxtjs/tailwindcss": "^6.1.3",
    "@tailwindcss/forms": "^0.5.2"
  },
  "dependencies": {
    "@headlessui/vue": "^1.6.5"
  }

Let me know how it goes!

@misbahansori
Copy link
Author

misbahansori commented Oct 27, 2023

Wow, it works out of the box. However, I found an issue with this approach, the typescript type for the user is not correct, I use a first_name and last_name format for the user. I there a way to configure it?

I also don't want the pages, but for this case, I can just replace them with my own. The things that I want to use in my project are the composables, middleware, plugins, and utils. Is it also possible to be configured?

@carlosvaldesweb
Copy link

@misbahansori Maybe you can override directly the composables. e.g.

useAuth.ts

export type User = {
  first_name: string;
  last_name: string;
  email?: string;
};


export type RegisterCredentials = {
  first_name: string;
  last_name:string;
  email: string;
  password: string;
  password_confirmation: string;
};

But after that you should overwrite the pages that need to be modified. I think that only register page. Maybe @amrnn90 has other answer.

@amrnn90
Copy link
Owner

amrnn90 commented Oct 27, 2023

I have added a generic type for the user, so now you can wrap the useAuth composable with your own like this:

// composables/useMyAuth.ts

type User = {
  first_name: string;
  last_name: string;
};

export function useMyAuth() {
  return useAuth<User>();
}

As for selectively choosing which parts of the layer to include, I do not know if it is possible right now, I think it would be a nice feature to have, you should open a feature request in Nuxt.

@amrnn90 amrnn90 reopened this Oct 27, 2023
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

No branches or pull requests

3 participants