rename isCollaborator to hasWriteAccess
This commit is contained in:
parent
6df35a2f30
commit
0dd173a83f
@ -19,7 +19,7 @@ export default class API {
|
||||
return this.request("/user");
|
||||
}
|
||||
|
||||
isCollaborator(user) {
|
||||
hasWriteAccess() {
|
||||
return this.request(this.repoURL)
|
||||
.then(repo => repo.permissions.push)
|
||||
.catch(error => {
|
||||
|
@ -32,7 +32,7 @@ export default class GitHub {
|
||||
this.token = state.token;
|
||||
this.api = new API({ token: this.token, branch: this.branch, repo: this.repo, api_root: this.api_root });
|
||||
return this.api.user().then(user =>
|
||||
this.api.isCollaborator(user.login).then((isCollab) => {
|
||||
this.api.hasWriteAccess().then((isCollab) => {
|
||||
// Unauthorized user
|
||||
if (!isCollab) throw new Error("Your GitHub user account does not have access to this repo.");
|
||||
// Authorized user
|
||||
|
Loading…
x
Reference in New Issue
Block a user