Projects Dropdown App Store
This commit is contained in:
parent
43a27f845a
commit
446b0340fd
1 changed files with 33 additions and 0 deletions
|
@ -0,0 +1,33 @@
|
|||
export default class ProjectsStore {
|
||||
constructor() {
|
||||
this.state = {};
|
||||
this.state.frequentProjects = [];
|
||||
this.state.searchedProjects = [];
|
||||
}
|
||||
|
||||
setFrequentProjects(rawProjects) {
|
||||
this.state.frequentProjects = rawProjects;
|
||||
}
|
||||
|
||||
getFrequentProjects() {
|
||||
return this.state.frequentProjects;
|
||||
}
|
||||
|
||||
setSearchedProjects(rawProjects) {
|
||||
this.state.searchedProjects = rawProjects.map(rawProject => ({
|
||||
id: rawProject.id,
|
||||
name: rawProject.name,
|
||||
namespace: rawProject.name_with_namespace,
|
||||
webUrl: rawProject.web_url,
|
||||
avatarUrl: rawProject.avatar_url,
|
||||
}));
|
||||
}
|
||||
|
||||
getSearchedProjects() {
|
||||
return this.state.searchedProjects;
|
||||
}
|
||||
|
||||
clearSearchedProjects() {
|
||||
this.state.searchedProjects = [];
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue