Add i18n support (#7)
This commit is contained in:
1 parent
7d5dc8965e
commit
7b292b104c
368 files changed
+19351
-1420
No files matched your search
@@ -2,6 +2,7 @@ import { ActionContext } from 'vuex';
|
||||
import { IRootState } from '../common/models';
|
||||
import { userOperator, oauthOperator } from '@/operators';
|
||||
import { log } from '@/utils/log';
|
||||
import { IToken, IUser } from '@/models';
|
||||
|
||||
export const resetAll = ({ commit }: ActionContext<IRootState, IRootState>) => {
|
||||
commit('resetToken');
|
||||
@@ -24,6 +25,10 @@ export const setToken = ({ commit }: ActionContext<IRootState, IRootState>, payl
|
||||
commit('setToken', payload);
|
||||
};
|
||||
|
||||
export const setLocale = ({ commit }: ActionContext<IRootState, IRootState>, payload: string) => {
|
||||
commit('setLocale', payload);
|
||||
};
|
||||
|
||||
export const setUser = ({ commit }: ActionContext<IRootState, IRootState>, payload: IUser) => {
|
||||
commit('setUser', payload);
|
||||
};
|
||||
@@ -52,6 +57,7 @@ export const getToken = async ({ commit }: ActionContext<IRootState, IRootState>
|
||||
};
|
||||
|
||||
export default {
|
||||
setLocale,
|
||||
resetToken,
|
||||
resetAll,
|
||||
resetUser,
|
||||
|
||||
@@ -8,6 +8,10 @@ export const user = (state: IRootState): any => {
|
||||
return state.user;
|
||||
};
|
||||
|
||||
export const locale = (state: IRootState): string => {
|
||||
return state.locale;
|
||||
};
|
||||
|
||||
export const token = (state: IRootState): any => {
|
||||
return state.token;
|
||||
};
|
||||
@@ -17,6 +21,7 @@ export const setting = (state: IRootState): any => {
|
||||
};
|
||||
|
||||
export default {
|
||||
locale,
|
||||
authenticated,
|
||||
user,
|
||||
token,
|
||||
|
||||
@@ -11,6 +11,7 @@ export interface ICommonState {
|
||||
token: IToken;
|
||||
user: IUser;
|
||||
setting?: ISetting;
|
||||
locale: string;
|
||||
}
|
||||
|
||||
export interface IRootState extends ICommonState {
|
||||
|
||||
@@ -8,6 +8,10 @@ export const setUser = (state: IRootState, payload: IUser): void => {
|
||||
};
|
||||
};
|
||||
|
||||
export const setLocale = (state: IRootState, payload: string): void => {
|
||||
state.locale = payload;
|
||||
};
|
||||
|
||||
export const setToken = (state: IRootState, payload: any): void => {
|
||||
state.token = {
|
||||
...state.token,
|
||||
@@ -35,6 +39,7 @@ export const setSetting = (state: IRootState, payload: any): void => {
|
||||
};
|
||||
|
||||
export default {
|
||||
setLocale,
|
||||
setUser,
|
||||
resetUser,
|
||||
setToken,
|
||||
|
||||
Reference in new issue
Block a user