ataractic
ataractic2y ago

What are newUserProps()

I'm reading saaskit source, and I don't understand the point of newUserProps(). Why not just define isSubscribed in the createUser() function with all the other values as it is in the interface as well? We could just set it to false by default?
8 Replies
ataractic
ataracticOP2y ago
ataractic
ataracticOP2y ago
If I want to add properties to my user, should i add them to newUserProps() or directly into createUser() ?
ioB
ioB2y ago
@iuioiua
iuioiua
iuioiua2y ago
Hi there. Previously, the method you suggested was used. However, we moved the logic that generates the objects outside their respective createX() functions as it significantly improved usability. See https://github.com/denoland/saaskit/pull/292, https://github.com/denoland/saaskit/pull/290 and https://github.com/denoland/saaskit/pull/284 for more context.
GitHub
refactor: items logic in KV by iuioiua · Pull Request #284 · denola...
Before, functions within util/db.ts did too much. E.g. createItem() generated an item, set it in KV, and then returned the generated item. Now, functions only do one thing, making things easier to ...
ataractic
ataracticOP2y ago
thank you for linking these PRs. So if I want to add my own members i should add them to newUserProps() as long as I don't need to get the object from the key value
iuioiua
iuioiua2y ago
Sorry, I don’t understand
ataractic
ataracticOP2y ago
anyways that's not really important, what I wanted is working now
iuioiua
iuioiua2y ago
Nice! Let me know if you have any other questions with SaaSKit 🙂

Did you find this page helpful?