This file contains 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'; | |
/** Default config for axios instance */ | |
let config = { | |
baseURL: 'http://localhost:3000/' | |
}; | |
/** Creating the instance for axios */ | |
const httpClient = axios.create(config); |
This file contains 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 { reflectKeys } from '@/app/shared/services'; | |
import { fetchUsers } from '../services'; | |
/** Initial state */ | |
const initialState = { | |
loading: false, | |
data: null, | |
error: null | |
}; |
This file contains 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 { usersData } from './shared/state'; | |
export default { | |
modules: { | |
usersData | |
} | |
}; |
This file contains 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 Vue from 'vue'; | |
import Vuex from 'vuex'; | |
import { usersState } from './users'; | |
Vue.use(Vuex); | |
export default new Vuex.Store({ | |
state: {}, | |
mutations: {}, |
This file contains 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 Vue from 'vue'; | |
Vue.config.errorHandler = (err, vm, info) => { | |
// err: error trace | |
// vm: component in which error occured | |
// info: Vue specific error information such as lifecycle hooks, events etc. | |
// TODO: Perform any custom logic or log to server | |
}; |
This file contains 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
window.onerror = function(message, source, lineno, colno, error) { | |
// TODO: write any custom logic or logs the error | |
}; |
This file contains 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
export default { | |
name: "app-user-list", | |
created() { | |
this.$store.dispatch(actionsTypes.FETCH_USER_DATA); | |
}, | |
errorCaptured(err, vm, info) { | |
// err: error trace | |
// vm: component in which error occured |
This file contains 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
<template> | |
<div> | |
<slot | |
v-if="err" | |
name="error" | |
v-bind:err="err" | |
v-bind:vm="vm" | |
v-bind:info="info" | |
>Something went wrong</slot> | |
<slot v-else></slot> |
This file contains 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
<template> | |
<div class="user-list"> | |
<error-boundary> | |
<app-user-item/> | |
</error-boundary> | |
</div> | |
</template> |