mercurjs / mercur-vendor-starter

0 stars 6 forks source link

Unable to Create Product on Vendor Admin #1

Open herawais opened 4 months ago

herawais commented 4 months ago

Hi Mercur Team I am able to run the Vendor Admin Dashboard successfully however when i try to create a product, it is giving following error

TypeError: Cannot destructure property 'store' of '((intermediate value) && useAdminStore(...))' as it is null. at NewProduct (http://localhost:7000/src/domain/products/new/index.tsx:155:11) at renderWithHooks (http://localhost:7000/node_modules/.vite/deps/chunk-OZ6A2BMG.js?v=fd4d8b23:11568:26) at mountIndeterminateComponent (http://localhost:7000/node_modules/.vite/deps/chunk-OZ6A2BMG.js?v=fd4d8b23:14946:21) at beginWork (http://localhost:7000/node_modules/.vite/deps/chunk-OZ6A2BMG.js?v=fd4d8b23:15934:22) at beginWork$1 (http://localhost:7000/node_modules/.vite/deps/chunk-OZ6A2BMG.js?v=fd4d8b23:19781:22) at performUnitOfWork (http://localhost:7000/node_modules/.vite/deps/chunk-OZ6A2BMG.js?v=fd4d8b23:19226:20) at workLoopSync (http://localhost:7000/node_modules/.vite/deps/chunk-OZ6A2BMG.js?v=fd4d8b23:19165:13) at renderRootSync (http://localhost:7000/node_modules/.vite/deps/chunk-OZ6A2BMG.js?v=fd4d8b23:19144:15) at recoverFromConcurrentError (http://localhost:7000/node_modules/.vite/deps/chunk-OZ6A2BMG.js?v=fd4d8b23:18764:28) at performConcurrentWorkOnRoot (http://localhost:7000/node_modules/.vite/deps/chunk-OZ6A2BMG.js?v=fd4d8b23:18712:30)

gtomaka commented 4 months ago

Hi @herawais, thanks for your message. The issue you encountered is due to logging into the vendor panel with an admin account. You need to create a vendor account, log in with that, and then try to add a product. We need to prevent logging into the vendor panel with an admin account, as admins are not allowed to add products in this setup.

I assume you might have had a problem creating a vendor account. I realized there was a mistake in the README; there is no need to execute medusa migrations run as it interferes with executing yarn seed properly. Using yarn seed alone is sufficient. If you have already attempted this, please clean the database, execute yarn seed again, and then you will be able to create a vendor by POST to http://localhost:9000/vendor/users with the following credentials:

{ "email": "email@email.com", "password": "test123" }

With a vendor account, you will be able to add products.

gtomaka commented 4 months ago