Vuex Plugin for Nuxt.js
Example usage
import { GetterTree, ActionTree, MutationTree } from 'vuex'
import Plugin, { IConfig } from '@abler/ats-vuex-plugin'
import { Audience } from '@abler/ats-front-resources-api/lib/support'
export const state = () => ({})
export const plugins = [Plugin]
export type RootState = ReturnType<typeof state>
export const getters: GetterTree<RootState, RootState> = {}
export const mutations: MutationTree<RootState> = {}
export const actions: ActionTree<RootState, RootState> = {
async nuxtServerInit ({ dispatch }, { req }) {
const config: IConfig = {
apiBaseURL: 'http://localhost:3000/api',
cookie: req.headers.cookie,
audience: Audience.CANDIDATE,
referrerSource: 'someSource',
hostname: '.localhost'
}
await dispatch('root/setConfig', config, { root: true })
}
}
Docs