Page MenuHomePhabricator

Make all vuex actions that make API requests return a promise
Closed, ResolvedPublic

Description

right now there are actions that require user authentication to be performed. The way we handle that currently is to check if the user performing the action is authenticated. If the user is authenticated, we perform the action and return a promise and if not, we return undefined.
The problem with this is that the action now have two potential return types and you need to check for the two different return types before making use of the return value.
To fix this, we need to always return a promise in the actions. That way we only need to change to return value of the action with .then, and not bother about checking if the return type is a promise or undefined.

Acceptance Criteria
  • ensure that all vuex actions that perform api requests always return a promise

Event Timeline

bd808 triaged this task as Low priority.Feb 9 2022, 6:12 PM
bd808 moved this task from In Progress to Groomed/Ready on the Toolhub board.

Change 761696 had a related patch set uploaded (by Raymond Ndibe; author: Raymond Ndibe):

[wikimedia/toolhub@main] ui: Make all vuex actions that make API requests return a promise

https://gerrit.wikimedia.org/r/761696

Change 761696 merged by jenkins-bot:

[wikimedia/toolhub@main] ui: Make all vuex actions that make API requests return a promise

https://gerrit.wikimedia.org/r/761696

Change 770638 had a related patch set uploaded (by BryanDavis; author: Bryan Davis):

[operations/deployment-charts@master] toolhub: Bump container version to 2022-03-15-002555-production

https://gerrit.wikimedia.org/r/770638

Change 770638 merged by jenkins-bot:

[operations/deployment-charts@master] toolhub: Bump container version to 2022-03-15-002555-production

https://gerrit.wikimedia.org/r/770638