Skip to content

Commit

Permalink
feat: network functions improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
zovomat committed Mar 16, 2022
1 parent 4d66a77 commit 99c93d3
Show file tree
Hide file tree
Showing 20 changed files with 410 additions and 416 deletions.
10 changes: 4 additions & 6 deletions src/boot/app/app-loader-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import {
useUserAccounts,
useUserSettings,
useTags,
useNotify,
useRefresh,
useUserRight,
useUserRights,
getUserRight,
Expand All @@ -45,8 +43,7 @@ import {
useIntegratedFunction,
useIntegratedHook
} from '../../store/integrations/hooks';
import { CarbonioModule } from '../../../types';
import { getEditSettingsForApp } from '../../network/edit-settings';
import { CarbonioModule, useNotify, useRefresh } from '../../../types';
import {
usePushHistoryCallback,
useGoBackHistoryCallback,
Expand All @@ -63,11 +60,12 @@ import {
useRemoveCurrentBoard,
useUpdateCurrentBoard
} from '../../shell/boards/board-hooks';
import { getSoapFetch, getXmlSoapFetch } from '../../network/fetch';

// eslint-disable-next-line @typescript-eslint/ban-types
export const getAppFunctions = (pkg: CarbonioModule): Record<string, Function> => ({
soapFetch: useAccountStore.getState().soapFetch(pkg.name),
xmlSoapFetch: useAccountStore.getState().xmlSoapFetch(pkg.name),
soapFetch: getSoapFetch(pkg.name),
xmlSoapFetch: getXmlSoapFetch(pkg.name),

// APP STORE FUNCTIONS
useAppContext: useAppContext(pkg.name),
Expand Down
22 changes: 10 additions & 12 deletions src/boot/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ import { registerDefaultViews } from './app/default-views';
import { loadApps } from './app/load-apps';
import I18nFactory from '../i18n/i18n-factory';
import StoreFactory from '../redux/store-factory';
import { getInfo } from '../network/get-info';

export const init = (_i18nFactory: I18nFactory, _storeFactory: StoreFactory): void => {
useAccountStore
.getState()
.init()
.then(() => {
_i18nFactory.setLocale(
(
(useAccountStore.getState().settings?.prefs?.zimbraPrefLocale as string) ??
(useAccountStore.getState().settings?.attrs?.zimbraLocale as string)
)?.split?.('_')?.[0] ?? 'en'
);
loadApps(_storeFactory, Object.values(useAppStore.getState().apps));
});
getInfo().then(() => {
_i18nFactory.setLocale(
(
(useAccountStore.getState().settings?.prefs?.zimbraPrefLocale as string) ??
(useAccountStore.getState().settings?.attrs?.zimbraLocale as string)
)?.split?.('_')?.[0] ?? 'en'
);
loadApps(_storeFactory, Object.values(useAppStore.getState().apps));
});
};
Loading

0 comments on commit 99c93d3

Please sign in to comment.