This commit is contained in:
@@ -19,5 +19,8 @@ export default {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: "Bearer " + store.state.apiToken
|
||||
};
|
||||
},
|
||||
APIUrl() {
|
||||
return store.state.apiUrl;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import config from "../utils/config";
|
||||
import api from "./apiutil";
|
||||
import apiUtil from "./apiutil";
|
||||
import { processLogin, processLogout } from "../utils/authutil";
|
||||
|
||||
export default {
|
||||
async authenticate(login, password) {
|
||||
return fetch(config.apiUrl + "auth", {
|
||||
return fetch(apiUtil.APIUrl + "auth", {
|
||||
method: "post",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
@@ -16,8 +15,8 @@ export default {
|
||||
password: password
|
||||
})
|
||||
})
|
||||
.then(api.status)
|
||||
.then(api.json)
|
||||
.then(apiUtil.status)
|
||||
.then(apiUtil.json)
|
||||
.then(processLogin)
|
||||
.then(() => {
|
||||
return Promise.resolve(true);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* xeslint-disable */
|
||||
import store from "../store";
|
||||
import config from "../utils/config";
|
||||
import api from "./apiutil";
|
||||
import apiUtil from "./apiutil";
|
||||
import _ from "../utils/libs/core.min.js";
|
||||
|
||||
export default {
|
||||
@@ -24,14 +23,14 @@ export default {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
fetch(config.apiUrl + "locale/subset", {
|
||||
fetch(apiUtil.APIUrl + "locale/subset", {
|
||||
method: "post",
|
||||
mode: "cors",
|
||||
headers: api.AuthorizedHeaders(),
|
||||
headers: apiUtil.AuthorizedHeaders(),
|
||||
body: JSON.stringify(NeedIt)
|
||||
})
|
||||
.then(api.status)
|
||||
.then(api.json)
|
||||
.then(apiUtil.status)
|
||||
.then(apiUtil.json)
|
||||
.then(response => {
|
||||
_.forEach(response.data, function(item) {
|
||||
store.commit("addLocaleText", item);
|
||||
|
||||
Reference in New Issue
Block a user