Created
May 13, 2018 11:48
-
-
Save sultaniman/b0f3cd613292ebdd16e08624a8a690d5 to your computer and use it in GitHub Desktop.
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 { checkResponse, get, post } from '@/helpers/http' | |
| export function getCSRFToken() { | |
| return get('/api/security/csrf/token') | |
| .then(checkResponse) | |
| } | |
| export function verifyToken(token) { | |
| token = token || localStorage.token | |
| if (token) { | |
| return post('/api/auth/token/verify', {token}) | |
| .then(checkResponse) | |
| } | |
| return Promise.reject(new Error('ERR_NO_TOKEN')) | |
| } | |
| export function loginUser(credentials) { | |
| return post('/api/auth/token', credentials) | |
| .then(checkResponse) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment