github.com/covergates/covergates@v0.2.2-0.20201009050117-42ef8a19fb95/web/src/store/modules/repository/mutations.ts (about)

     1  import { RepoState } from '.';
     2  
     3  export function startLoading(state: RepoState): void {
     4    state.loading = true;
     5  }
     6  
     7  export function stopLoading(state: RepoState): void {
     8    state.loading = false;
     9  }
    10  
    11  export function updateList(state: RepoState, repos: Repository[]): void {
    12    state.list.splice(0, state.list.length);
    13    state.list.push(...repos);
    14  }
    15  
    16  export function setCurrent(state: RepoState, repo: Repository): void {
    17    state.current = repo;
    18  }
    19  
    20  export function setError(state: RepoState, error?: Error): void {
    21    if (error) {
    22      state.error = error;
    23    } else {
    24      state.error = undefined;
    25    }
    26  }
    27  
    28  export function setSetting(state: RepoState, setting?: RepositorySetting): void {
    29    state.setting = setting;
    30  }
    31  
    32  export function setOwner(state: RepoState, owner: boolean): void {
    33    state.owner = owner;
    34  }
    35  
    36  export function setCommits(state: RepoState, commits: Commit[]): void {
    37    state.commits.splice(0, state.commits.length);
    38    state.commits.push(...commits);
    39  }
    40  
    41  export function setBranches(state: RepoState, branches: string[]): void {
    42    state.branches.splice(0, state.branches.length);
    43    state.branches.push(...branches);
    44  }