Created
March 12, 2019 11:52
-
-
Save erandirjunior/54f8783785fa558ffc0ee651a4b0164b to your computer and use it in GitHub Desktop.
Autorização
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios' | |
export default class Permission { | |
constructor (idUser) { | |
this.$axios = axios | |
this.permissions = [] | |
this.getPermission(idUser) | |
} | |
async getPermission () { | |
const token = localStorage.getItem('token') | |
await this.$axios.post(`${process.env.API}/permissions`, { token }) | |
.then(resp => resp.data) | |
.then(resp => resp.data) | |
.then(resp => { | |
this.permissions = resp | |
}) | |
} | |
hasPermission (number) { | |
return this.permissions[number] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment