import { Notification, toast } from '@/components/ui' import { generateBackgroundWorkers } from '@/services/background-worker.service' import { getLocalization } from '@/services/localization.service' import { store } from '@/store' import { clearRedisCache } from './languageText.service' export abstract class UiEvalService { static Init = () => { //console.log('init') } static ApiGenerateBackgroundWorkers = () => { // Get store state directly instead of using hook const state = store.getState() const { texts, config } = state.abpConfig // Create translate function similar to useLocalization hook const translate = ( localizationKey: string, params?: Record, defaultResourceName?: string, ): string => { if (!texts) { return localizationKey } return getLocalization( texts, defaultResourceName ?? config?.localization?.defaultResourceName, localizationKey, params, ) } const asyncCall = async () => { await generateBackgroundWorkers() } asyncCall() toast.push( {translate('::App.BackgroundWorkers.Message')} , { placement: 'top-end', }, ) } static ApiClearRedisCache = () => { // Get store state directly instead of using hook const state = store.getState() const { texts, config } = state.abpConfig // Create translate function similar to useLocalization hook const translate = ( localizationKey: string, params?: Record, defaultResourceName?: string, ): string => { if (!texts) { return localizationKey } return getLocalization( texts, defaultResourceName ?? config?.localization?.defaultResourceName, localizationKey, params, ) } const asyncCall = async () => { await clearRedisCache() } asyncCall() toast.push( {translate('::App.ClearRedisCache.Message')} , { placement: 'top-end', }, ) } } const _global = (window || global) as any _global.UiEvalService = UiEvalService