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

REST shortcut doesn't handle action object correctly #344

Open
thib3113 opened this issue Nov 28, 2023 · 0 comments
Open

REST shortcut doesn't handle action object correctly #344

thib3113 opened this issue Nov 28, 2023 · 0 comments

Comments

@thib3113
Copy link
Contributor

The problem is here : https://github.com/moleculerjs/moleculer-web/blob/master/src/index.js#L1469

If I setup an alias like :

{
  "REST /users": {
    action : "action"
  }
}

it will treat the action as a string . But it's an object .

it's maybe better to just check if action is not a string ? ( or better if action is an object )

	if (typeof action === "object" && action.action) {
		if (action.only) {
			actions = actions.filter(item => action.only.includes(item));
		}

		if (action.except) {
			actions = actions.filter(item => !action.except.includes(item));
		}

		action = action.action;
	}
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

1 participant