Files
mixtape/zero.Backoffice.UI/app/stores/translations.ts
T
2021-12-14 11:54:36 +01:00

28 lines
555 B
TypeScript

import { defineStore } from 'pinia';
import uiApi from '../ui/api';
export type TranslationState = {
culture: string,
translations: Record<string, string>
};
export const useTranslationStore = defineStore('zero.translations', {
state: () => ({
culture: null,
translations: { }
} as TranslationState),
actions: {
find(key: string): string
{
return this.translations[key.toLowerCase()];
},
async setup()
{
var result = await uiApi.getTranslations();
this.translations = result.data;
}
}
});