mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-23 16:03:46 +00:00
Migrated all service providers to typescript
This commit is contained in:
21
src/utils/services/provideServices.ts
Normal file
21
src/utils/services/provideServices.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import axios from 'axios';
|
||||
import Bottle from 'bottlejs';
|
||||
import { useStateFlagTimeout } from '../helpers/hooks';
|
||||
import Storage from './Storage';
|
||||
import ColorGenerator from './ColorGenerator';
|
||||
import buildShlinkApiClient from './ShlinkApiClientBuilder';
|
||||
|
||||
const provideServices = (bottle: Bottle) => {
|
||||
bottle.constant('localStorage', (global as any).localStorage);
|
||||
bottle.service('Storage', Storage, 'localStorage');
|
||||
bottle.service('ColorGenerator', ColorGenerator, 'Storage');
|
||||
|
||||
bottle.constant('axios', axios);
|
||||
bottle.serviceFactory('buildShlinkApiClient', buildShlinkApiClient, 'axios');
|
||||
|
||||
bottle.constant('setTimeout', global.setTimeout);
|
||||
bottle.constant('clearTimeout', global.clearTimeout);
|
||||
bottle.serviceFactory('useStateFlagTimeout', useStateFlagTimeout, 'setTimeout', 'clearTimeout');
|
||||
};
|
||||
|
||||
export default provideServices;
|
||||
Reference in New Issue
Block a user