Skip to content

Commit

Permalink
PATCH: fix: try to service singleton via constructor + fix getUsers
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRichel committed Oct 25, 2023
1 parent 218e8f0 commit e32fdd6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ import { getPriorityColor } from "./utils/topic.js";
import { downloadBlobAs } from "./utils/download.js";

class Service {
constructor () {
if (!Service.instance) Service.instance = this;
return Service.instance;
}

setup({ apiClient, fetchUsers }) {
this.apiClient = apiClient;
this.fetchUsers = fetchUsers;
}

_getUsers() {
_getUsers(project) {
return this.fetchUsers
? (project) => this.fetchUsers(project)
: (project) => this.apiClient.collaborationApi.getProjectUsers(project.cloud.id, project.id);
? this.fetchUsers(project)
: this.apiClient.collaborationApi.getProjectUsers(project.cloud.id, project.id);
}

fetchCurrentUser() {
Expand Down

0 comments on commit e32fdd6

Please sign in to comment.