diff --git a/src/_helpers/api-util.js b/src/_helpers/api-util.js deleted file mode 100644 index fea0046..0000000 --- a/src/_helpers/api-util.js +++ /dev/null @@ -1,113 +0,0 @@ -let landingPage = null; -export function getLandingPage () { return landingPage; } -export function setLandingPage (page) { landingPage = page; } -export function resetLandingPage () { landingPage = null; } - -export function currentUser() { - let userJson = localStorage.getItem('user'); - return userJson ? JSON.parse(userJson) : null; -} - -export function userLoggedIn() { return !!currentUser(); } - -export function authHeader() { - // return authorization header with jwt token - let user = currentUser(); - - if (user && user.token) { - return { 'X-Bubble-Session': user.token }; - } else { - return {}; - } -} - -export function getWithAuth() { - return { - method: 'GET', - headers: authHeader() - }; -} - -function entityWithAuth(method, obj) { - if (typeof obj === 'undefined' || obj === null || obj === 'undefined') { - return { - method: method, - headers: { ...authHeader(), 'Content-Type': 'application/json' } - }; - } else { - return { - method: method, - headers: { ...authHeader(), 'Content-Type': 'application/json' }, - body: JSON.stringify(obj) - }; - } -} - -export function postWithAuth(obj) { return entityWithAuth('POST', obj); } - -export function putWithAuth(obj) { return entityWithAuth('PUT', obj); } - -export function deleteWithAuth() { - return { - method: 'DELETE', - headers: authHeader() - }; -} - -export function handleBasicResponse(response) { - return response.text().then(text => { - const data = text && JSON.parse(text); - if (!response.ok) { - const error = (data && data.message) || response.statusText; - return Promise.reject(error); - } - return data; - }); -} - -export function handleCrudResponse(messages, errors) { - return function (response) { - return response.text().then(text => { - const data = text && JSON.parse(text); - if (!response.ok) { - if (response.status === 404) { - // todo: show nicer error message - console.log('handleCrudResponse: received 404: ' + JSON.stringify(data)); - - } else if (response.status === 422) { - console.log('handleCrudResponse: received 422, error: ' + JSON.stringify(data)); - setValidationErrors(data, messages, errors); - } - - const error = (data && data.message) || response.statusText; - return Promise.reject(error); - } - return data; - }); - } -} - -export function setValidationErrors(data, messages, errors) { - for (let i=0; i>>>> field '+field+' added error: '+message+', errors='+JSON.stringify(errors)); - } - } - // todo: else add "global" error message for unrecognized/non-field error - } -} - -export function checkLoading(loadingArray) { - return function() { - for (const key in loadingArray) { - if (key === true) return true; - } - return false; - }; -} \ No newline at end of file diff --git a/src/_helpers/index.js b/src/_helpers/index.js index b6df5c7..4d77d99 100644 --- a/src/_helpers/index.js +++ b/src/_helpers/index.js @@ -1,2 +1,2 @@ +export * from './util'; export * from './router'; -export * from './api-util'; \ No newline at end of file diff --git a/src/_helpers/router.js b/src/_helpers/router.js index 748b9f4..e507b3e 100644 --- a/src/_helpers/router.js +++ b/src/_helpers/router.js @@ -17,7 +17,7 @@ import AccountsPage from '../admin/AccountsPage' import StripePayment from "../account/payment/StripePayment"; import InviteCodePayment from "../account/payment/InviteCodePayment"; import UnknownPayment from "../account/payment/UnknownPayment"; -import { currentUser, setLandingPage } from '../_helpers' +import { util } from '../_helpers' Vue.use(Router); @@ -79,12 +79,12 @@ export const router = new Router({ router.beforeEach((to, from, next) => { const publicPages = ['/login', '/logout', '/register', '/auth']; const authRequired = !publicPages.includes(to.path); - const user = currentUser(); + const user = util.currentUser(); if (authRequired) { // redirect to login page if not logged in and trying to access a restricted page if (!user) { - setLandingPage(to); + util.setLandingPage(to); return next('/login'); } diff --git a/src/_helpers/util.js b/src/_helpers/util.js new file mode 100644 index 0000000..5754d09 --- /dev/null +++ b/src/_helpers/util.js @@ -0,0 +1,120 @@ +let landingPage = null; + +export const util = { + getLandingPage: function () { return landingPage; }, + setLandingPage: function (page) { landingPage = page; }, + resetLandingPage: function () { landingPage = null; }, + + currentUser: function() { + let userJson = localStorage.getItem('user'); + return userJson ? JSON.parse(userJson) : null; + }, + + userLoggedIn: function() { return !!util.currentUser(); }, + + authHeader: function() { + // return authorization header with jwt token + let user = util.currentUser(); + + if (user && user.token) { + return { 'X-Bubble-Session': user.token }; + } else { + return {}; + } + }, + + getWithAuth: function() { + return { + method: 'GET', + headers: authHeader() + }; + }, + + entityWithAuth: function(method, obj) { + if (typeof obj === 'undefined' || obj === null || obj === 'undefined') { + return { + method: method, + headers: { ...authHeader(), 'Content-Type': 'application/json' } + }; + } else { + return { + method: method, + headers: { ...authHeader(), 'Content-Type': 'application/json' }, + body: JSON.stringify(obj) + }; + } + }, + + postWithAuth: function(obj) { return entityWithAuth('POST', obj); }, + + putWithAuth: function(obj) { return entityWithAuth('PUT', obj); }, + + deleteWithAuth: function() { + return { + method: 'DELETE', + headers: authHeader() + }; + }, + + handleBasicResponse: function(response) { + return response.text().then(text => { + const data = text && JSON.parse(text); + if (!response.ok) { + const error = (data && data.message) || response.statusText; + return Promise.reject(error); + } + return data; + }); + }, + + handleCrudResponse: function(messages, errors) { + return function (response) { + return response.text().then(text => { + const data = text && JSON.parse(text); + if (!response.ok) { + if (response.status === 404) { + // todo: show nicer error message + console.log('handleCrudResponse: received 404: ' + JSON.stringify(data)); + + } else if (response.status === 422) { + console.log('handleCrudResponse: received 422, error: ' + JSON.stringify(data)); + setValidationErrors(data, messages, errors); + } + + const error = (data && data.message) || response.statusText; + return Promise.reject(error); + } + return data; + }); + } + }, + + setValidationErrors: function(data, messages, errors) { + for (let i=0; i>>>> field '+field+' added error: '+message+', errors='+JSON.stringify(errors)); + } + } + // todo: else add "global" error message for unrecognized/non-field error + } + }, + + checkLoading: function(loadingObject) { + return function() { + for (const key in loadingObject) { + if (loadingObject.hasOwnProperty(key)) { + if (loadingObject[key] === true) { + return true; + } + } + } + return false; + }; + }, +}; diff --git a/src/_services/accountPlan.service.js b/src/_services/accountPlan.service.js index 8987639..8e32d19 100644 --- a/src/_services/accountPlan.service.js +++ b/src/_services/accountPlan.service.js @@ -1,5 +1,6 @@ import config from 'config'; -import { getWithAuth, putWithAuth, handleCrudResponse } from '../_helpers'; +import { util } from '../_helpers'; +// import { util.getWithAuth, util.putWithAuth, util.handleCrudResponse } from '../_helpers'; export const accountPlanService = { getAll, @@ -8,13 +9,13 @@ export const accountPlanService = { }; function getAll(userId, messages, errors) { - return fetch(`${config.apiUrl}/users/${userId}/accountPlans`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users/${userId}/accountPlans`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } function getById(userId, accountPlanId, messages, errors) { - return fetch(`${config.apiUrl}/users/${userId}/accountPlans/${accountPlanId}`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users/${userId}/accountPlans/${accountPlanId}`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } function newAccountPlan(userId, accountPlan, messages, errors) { - return fetch(`${config.apiUrl}/users/${userId}/accountPlans`, putWithAuth(accountPlan)).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users/${userId}/accountPlans`, util.putWithAuth(accountPlan)).then(util.handleCrudResponse(messages, errors)); } diff --git a/src/_services/domain.service.js b/src/_services/domain.service.js index 77de39c..f971b40 100644 --- a/src/_services/domain.service.js +++ b/src/_services/domain.service.js @@ -1,5 +1,5 @@ import config from 'config'; -import {currentUser, getWithAuth, handleCrudResponse} from '../_helpers'; +import { util } from '../_helpers'; export const domainService = { getAll, @@ -7,9 +7,9 @@ export const domainService = { }; function getAll(messages, errors) { - return fetch(`${config.apiUrl}/me/domains`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/me/domains`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } function getById(domainId, messages, errors) { - return fetch(`${config.apiUrl}/me/domains/${domainId}`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/me/domains/${domainId}`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } diff --git a/src/_services/footprint.service.js b/src/_services/footprint.service.js index f771849..3fec19c 100644 --- a/src/_services/footprint.service.js +++ b/src/_services/footprint.service.js @@ -1,5 +1,5 @@ import config from 'config'; -import { getWithAuth, handleCrudResponse } from '../_helpers'; +import { util } from '../_helpers'; export const footprintService = { getAll, @@ -7,9 +7,9 @@ export const footprintService = { }; function getAll(messages, errors) { - return fetch(`${config.apiUrl}/me/footprints`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/me/footprints`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } function getById(footprintId, messages, errors) { - return fetch(`${config.apiUrl}/me/footprints/${footprintId}`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/me/footprints/${footprintId}`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } diff --git a/src/_services/network.service.js b/src/_services/network.service.js index 6c0f993..be8e676 100644 --- a/src/_services/network.service.js +++ b/src/_services/network.service.js @@ -1,5 +1,5 @@ import config from 'config'; -import { getWithAuth, handleCrudResponse } from '../_helpers'; +import { util } from '../_helpers'; export const networkService = { getAll, @@ -7,14 +7,14 @@ export const networkService = { }; function getAll(userId, messages, errors) { - return fetch(`${config.apiUrl}/users/${userId}/networks`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users/${userId}/networks`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } function getById(userId, networkId, messages, errors) { - return fetch(`${config.apiUrl}/users/${userId}/networks/${networkId}`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users/${userId}/networks/${networkId}`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } function getNearestRegions(userId, footprint, messages, errors) { const footprintParam = (typeof footprint === "undefined" || footprint === null || footprint === '') ? "" : `?footprint=${footprint}`; - return fetch(`${config.apiUrl}/me/regions/closest${footprintParam}`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/me/regions/closest${footprintParam}`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } diff --git a/src/_services/paymentMethod.service.js b/src/_services/paymentMethod.service.js index 09dc8f0..be97d26 100644 --- a/src/_services/paymentMethod.service.js +++ b/src/_services/paymentMethod.service.js @@ -1,5 +1,5 @@ import config from 'config'; -import { getWithAuth, putWithAuth, handleCrudResponse } from '../_helpers'; +import { util } from '../_helpers'; export const paymentMethodService = { getAll, @@ -10,22 +10,22 @@ export const paymentMethodService = { }; function getAll(messages, errors) { - return fetch(`${config.apiUrl}/paymentMethods`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/paymentMethods`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } function getById(paymentMethodId, messages, errors) { - return fetch(`${config.apiUrl}/paymentMethods/${paymentMethodId}`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/paymentMethods/${paymentMethodId}`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } function getAllByAccount(messages, errors) { - return fetch(`${config.apiUrl}/me/paymentMethods`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/me/paymentMethods`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } function getByAccountAndId(paymentMethodId, messages, errors) { - return fetch(`${config.apiUrl}/me/paymentMethods/${paymentMethodId}`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/me/paymentMethods/${paymentMethodId}`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } function addAccountPaymentMethod(paymentMethod, messages, errors) { console.log("pmService: paymentMethod="+JSON.stringify(paymentMethod)); - return fetch(`${config.apiUrl}/me/paymentMethods`, putWithAuth(paymentMethod)).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/me/paymentMethods`, util.putWithAuth(paymentMethod)).then(util.handleCrudResponse(messages, errors)); } diff --git a/src/_services/plan.service.js b/src/_services/plan.service.js index 9ac96cf..0498d6e 100644 --- a/src/_services/plan.service.js +++ b/src/_services/plan.service.js @@ -1,5 +1,5 @@ import config from 'config'; -import { getWithAuth, handleCrudResponse } from '../_helpers'; +import { util } from '../_helpers'; export const planService = { getAll, @@ -7,9 +7,9 @@ export const planService = { }; function getAll(messages, errors) { - return fetch(`${config.apiUrl}/plans`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/plans`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } function getById(planId, messages, errors) { - return fetch(`${config.apiUrl}/plans/${planId}`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/plans/${planId}`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } diff --git a/src/_services/system.service.js b/src/_services/system.service.js index 6e3e396..9aeec65 100644 --- a/src/_services/system.service.js +++ b/src/_services/system.service.js @@ -1,5 +1,5 @@ import config from 'config'; -import { getWithAuth, userLoggedIn, handleBasicResponse } from '../_helpers'; +import { util } from '../_helpers'; export const systemService = { loadSystemConfigs, @@ -10,37 +10,37 @@ export const systemService = { }; function loadSystemConfigs() { - const requestOptions = userLoggedIn() ? getWithAuth() : { method: 'GET' }; + const requestOptions = util.userLoggedIn() ? util.getWithAuth() : { method: 'GET' }; return fetch(`${config.apiUrl}/auth/configs`, requestOptions) - .then(handleBasicResponse) + .then(util.handleBasicResponse) .then(configs => { return configs; }); } function loadMessages(group, locale) { - const requestOptions = userLoggedIn() ? getWithAuth() : { method: 'GET' }; + const requestOptions = util.userLoggedIn() ? util.getWithAuth() : { method: 'GET' }; if (!locale || locale === '') locale = 'detect'; return fetch(`${config.apiUrl}/messages/${locale}/${group}`, requestOptions) - .then(handleBasicResponse) + .then(util.handleBasicResponse) .then(messages => { return messages; }); } function loadTimezones() { - const requestOptions = userLoggedIn() ? getWithAuth() : { method: 'GET' }; + const requestOptions = util.userLoggedIn() ? util.getWithAuth() : { method: 'GET' }; return fetch(`${config.apiUrl}/timezones`, requestOptions) - .then(handleBasicResponse) + .then(util.handleBasicResponse) .then(timezones => { return timezones; }); } function detectTimezone() { - const requestOptions = userLoggedIn() ? getWithAuth() : { method: 'GET' }; + const requestOptions = util.userLoggedIn() ? util.getWithAuth() : { method: 'GET' }; return fetch(`${config.apiUrl}/detect/timezone`, requestOptions) - .then(handleBasicResponse) + .then(util.handleBasicResponse) .then(timezone => { return timezone; }); } function detectLocale () { - const requestOptions = userLoggedIn() ? getWithAuth() : { method: 'GET' }; + const requestOptions = util.userLoggedIn() ? util.getWithAuth() : { method: 'GET' }; return fetch(`${config.apiUrl}/detect/locale`, requestOptions) - .then(handleBasicResponse) + .then(util.handleBasicResponse) .then(locales => { return locales; }); } diff --git a/src/_services/user.service.js b/src/_services/user.service.js index e9c9a8a..0dafde5 100644 --- a/src/_services/user.service.js +++ b/src/_services/user.service.js @@ -1,5 +1,5 @@ import config from 'config'; -import { getWithAuth, postWithAuth, deleteWithAuth, handleCrudResponse, setValidationErrors } from '../_helpers'; +import { util } from '../_helpers'; export const userService = { login, @@ -56,61 +56,61 @@ function register(user, messages, errors) { } function getAll(messages, errors) { - return fetch(`${config.apiUrl}/users`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } function getById(id, messages, errors) { - return fetch(`${config.apiUrl}/users/${id}`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users/${id}`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } function getPolicyById(id, messages, errors) { - return fetch(`${config.apiUrl}/users/${id}/policy`, getWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users/${id}/policy`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); } function updatePolicyById(id, policy, messages, errors) { - return fetch(`${config.apiUrl}/users/${id}/policy`, postWithAuth(policy)).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users/${id}/policy`, util.postWithAuth(policy)).then(util.handleCrudResponse(messages, errors)); } function addPolicyContactById(id, contact, messages, errors) { - return fetch(`${config.apiUrl}/users/${id}/policy/contacts`, postWithAuth(contact)).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users/${id}/policy/contacts`, util.postWithAuth(contact)).then(util.handleCrudResponse(messages, errors)); } function removePolicyContactByUuid(id, uuid, messages, errors) { - return fetch(`${config.apiUrl}/users/${id}/policy/contacts/${uuid}`, deleteWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users/${id}/policy/contacts/${uuid}`, util.deleteWithAuth()).then(util.handleCrudResponse(messages, errors)); } function approveAction(id, code, messages, errors) { - return fetch(`${config.apiUrl}/auth/approve/${code}`, postWithAuth([{'name': 'account', 'value': id}])) - .then(handleCrudResponse(messages, errors)) + return fetch(`${config.apiUrl}/auth/approve/${code}`, util.postWithAuth([{'name': 'account', 'value': id}])) + .then(util.handleCrudResponse(messages, errors)) .then(setSessionUser); } function sendAuthenticatorCode(id, code, verifyOnly, messages, errors) { - return fetch(`${config.apiUrl}/auth/authenticator`, postWithAuth({ + return fetch(`${config.apiUrl}/auth/authenticator`, util.postWithAuth({ account: id, token: code, verify: verifyOnly })) - .then(handleCrudResponse(messages, errors)) + .then(util.handleCrudResponse(messages, errors)) .then(setSessionUser); } function resendVerificationCode(id, contact, messages, errors) { - return fetch(`${config.apiUrl}/users/${id}/policy/contacts/verify`, postWithAuth(contact)) - .then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users/${id}/policy/contacts/verify`, util.postWithAuth(contact)) + .then(util.handleCrudResponse(messages, errors)); } function denyAction(id, code, messages, errors) { - return fetch(`${config.apiUrl}/auth/deny/${code}`, postWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/auth/deny/${code}`, util.postWithAuth()).then(util.handleCrudResponse(messages, errors)); } function update(user, messages, errors) { - return fetch(`${config.apiUrl}/users/${user.uuid}`, postWithAuth(user)).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users/${user.uuid}`, util.postWithAuth(user)).then(util.handleCrudResponse(messages, errors)); } // prefixed function name with underscore because delete is a reserved word in javascript function _delete(id, messages, errors) { - return fetch(`${config.apiUrl}/users/${id}`, deleteWithAuth()).then(handleCrudResponse(messages, errors)); + return fetch(`${config.apiUrl}/users/${id}`, util.deleteWithAuth()).then(util.handleCrudResponse(messages, errors)); } function handleAuthResponse(messages, errors) { @@ -129,7 +129,7 @@ function handleAuthResponse(messages, errors) { console.log('handleAuthResponse: received 404, user not found: '+JSON.stringify(data)); } else if (response.status === 422) { - setValidationErrors(data, messages, errors); + util.setValidationErrors(data, messages, errors); } const error = (data && data.message) || response.statusText; return Promise.reject(error); diff --git a/src/_store/account.module.js b/src/_store/account.module.js index a159c40..10290e8 100644 --- a/src/_store/account.module.js +++ b/src/_store/account.module.js @@ -1,5 +1,5 @@ import { userService } from '../_services'; -import { router, getLandingPage, resetLandingPage } from '../_helpers'; +import { router, util } from '../_helpers'; // todo: why can't we import currentUser from api-util and use that here? // when I try to do that, webpack succeeds but then an error occurs loading any page, with the @@ -22,11 +22,11 @@ const actions = { user => { commit('loginSuccess', user); if (user.token) { - const landing = getLandingPage(); + const landing = util.getLandingPage(); if (landing === null) { router.replace('/'); } else { - resetLandingPage(); + util.resetLandingPage(); router.replace(landing.fullPath); } } else if (user.multifactorAuth) { diff --git a/src/_store/accountPlans.module.js b/src/_store/accountPlans.module.js index 41ea07e..b5257a6 100644 --- a/src/_store/accountPlans.module.js +++ b/src/_store/accountPlans.module.js @@ -1,6 +1,6 @@ import { accountPlanService } from '../_services'; import { account } from '../_store/account.module'; -import { checkLoading } from "../_helpers"; +import { util } from '../_helpers'; const state = { loading: {plans: false, plan: false, deleting: false}, @@ -82,7 +82,7 @@ const mutations = { }; const getters = { - loading: checkLoading(state.loading) + loading: util.checkLoading(state.loading) }; export const accountPlans = { diff --git a/src/_store/domains.module.js b/src/_store/domains.module.js index 734c0a9..543bfbb 100644 --- a/src/_store/domains.module.js +++ b/src/_store/domains.module.js @@ -1,5 +1,5 @@ import { domainService } from '../_services'; -import { checkLoading } from "../_helpers"; +import { util } from '../_helpers'; const state = { loading: { @@ -56,7 +56,7 @@ const mutations = { }; const getters = { - loading: checkLoading(state.loading) + loading: util.checkLoading(state.loading) }; export const domains = { diff --git a/src/_store/footprints.module.js b/src/_store/footprints.module.js index 659e335..12853b0 100644 --- a/src/_store/footprints.module.js +++ b/src/_store/footprints.module.js @@ -1,5 +1,5 @@ import { footprintService } from '../_services'; -import { checkLoading } from "../_helpers"; +import { util } from '../_helpers'; const state = { loading: { footprints: false, footprint: false }, @@ -54,7 +54,7 @@ const mutations = { }; const getters = { - loading: checkLoading(state.loading) + loading: util.checkLoading(state.loading) }; export const footprints = { diff --git a/src/_store/networks.module.js b/src/_store/networks.module.js index b88ced8..2db826c 100644 --- a/src/_store/networks.module.js +++ b/src/_store/networks.module.js @@ -1,6 +1,6 @@ import { networkService } from '../_services'; import { account } from '../_store/account.module'; -import { checkLoading } from "../_helpers"; +import { util } from '../_helpers'; const state = { loading: { @@ -107,7 +107,7 @@ const mutations = { }; const getters = { - loading: checkLoading(state.loading) + loading: util.checkLoading(state.loading) }; export const networks = { diff --git a/src/_store/paymentMethods.module.js b/src/_store/paymentMethods.module.js index 3ad02b6..cfa7668 100644 --- a/src/_store/paymentMethods.module.js +++ b/src/_store/paymentMethods.module.js @@ -1,5 +1,5 @@ import { paymentMethodService } from '../_services'; -import { checkLoading } from "../_helpers"; +import { util } from '../_helpers'; const state = { loading: { @@ -149,7 +149,7 @@ const mutations = { }; const getters = { - loading: checkLoading(state.loading) + loading: util.checkLoading(state.loading) }; export const paymentMethods = { diff --git a/src/_store/plans.module.js b/src/_store/plans.module.js index 02f1bbd..5849e87 100644 --- a/src/_store/plans.module.js +++ b/src/_store/plans.module.js @@ -1,5 +1,5 @@ import { planService } from '../_services'; -import { checkLoading } from "../_helpers"; +import { util } from '../_helpers'; const state = { loading: {plans: false, plan: false, deleting: false}, @@ -78,7 +78,7 @@ const mutations = { }; const getters = { - loading: checkLoading(state.loading) + loading: util.checkLoading(state.loading) }; export const plans = { diff --git a/src/_store/users.module.js b/src/_store/users.module.js index bf0d652..8f5079e 100644 --- a/src/_store/users.module.js +++ b/src/_store/users.module.js @@ -1,6 +1,6 @@ import { userService } from '../_services'; import { account } from '../_store/account.module'; -import { checkLoading } from "../_helpers"; +import { util } from '../_helpers'; const state = { loading: { @@ -249,7 +249,7 @@ const mutations = { }; const getters = { - loading: checkLoading(state.loading) + loading: util.checkLoading(state.loading) }; export const users = { diff --git a/src/account/NewNetworkPage.vue b/src/account/NewNetworkPage.vue index 76be6e0..4f6972e 100644 --- a/src/account/NewNetworkPage.vue +++ b/src/account/NewNetworkPage.vue @@ -164,7 +164,7 @@