From 91aa2739e8ce2b1be09a1d3a85a2922f3f8abc8f Mon Sep 17 00:00:00 2001 From: johnniang Date: Mon, 29 Apr 2019 19:32:14 +0800 Subject: [PATCH] Add authentication api --- src/api/admin.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/api/admin.js b/src/api/admin.js index 85dd8dba..c9b9316a 100644 --- a/src/api/admin.js +++ b/src/api/admin.js @@ -18,4 +18,29 @@ adminApi.install = data => { method: 'post' }) } + +adminApi.login = (username, password) => { + return service({ + url: `${baseUrl}/login`, + data: { + username: username, + password: password + }, + method: 'post' + }) +} + +adminApi.logout = () => { + return service({ + url: `${baseUrl}/logout`, + method: 'post' + }) +} + +adminApi.refreshToken = refreshToken => { + return service({ + url: `${baseUrl}/refresh/${refreshToken}`, + method: 'post' + }) +} export default adminApi