mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-07-23 12:11:59 +00:00
Added more behavior to servers list
This commit is contained in:
19
src/servers/services/index.js
Normal file
19
src/servers/services/index.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const PREFIX = 'shlink';
|
||||
const buildPath = path => `${PREFIX}.${path}`;
|
||||
|
||||
export class ServersService {
|
||||
constructor(storage) {
|
||||
this.storage = storage;
|
||||
}
|
||||
|
||||
listServers = () => {
|
||||
return JSON.parse(this.storage.getItem(buildPath('servers')) || '{}');
|
||||
};
|
||||
|
||||
findServerById = serverId => {
|
||||
const servers = this.listServers();
|
||||
return servers[serverId];
|
||||
}
|
||||
}
|
||||
|
||||
export default new ServersService(localStorage);
|
||||
Reference in New Issue
Block a user