gochargetech / erdjs-vue

A Vue.js library that holds the core functional logic of a dApp on the MultiversX (formerly Elrond)
5 stars 2 forks source link

Router auth and code improvements #19

Open johnykes opened 1 year ago

johnykes commented 1 year ago

Hi, I have few suggestions:

PS: I tried installing the package into a fresh vue 3 project, but I keep getting error. Update: works with const { erdjsVue } = require("erdjs-vue");

webpack compiled with 1 error
ERROR in src/main.ts:11:26
TS7016: Could not find a declaration file for module 'erdjs-vue'. 'D:/Projects/MyProject/node_modules/erdjs-vue/dist/erdjs-vue.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/erdjs-vue` if it exists or add a new declaration (.d.ts) file containing `declare module 'erdjs-vue';

Also, much thanks for creating this repo <3

ionvv commented 1 year ago

Thanks for opening this PR. Check my comments below:

check somehow if user is logged in router only; if not logged, redirect to /login?to={PAGE_NAME}, else, let him access the page; I made some changes, but I really don't know how to check if the user is logged in in router file;

I thought about this, but this will give headache to apps using other login methods and having the same login path defined in app and not in library

use views folder for pages and components only for real components; I've structured it according to Atomic Design principles, ie in components you'll find atoms, molecules, organisms and pagesdirectories

get MultiversX environment from .env file instead of hardcoding it; also get walletconnect key from env var. Yep, you're defining this in your .env file and pass them. See this example

This repo is a good starting point on how to integrate erdjs-vue