mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-05-31 01:26:16 +00:00
Implemented first elements of short codes list
This commit is contained in:
@@ -1,18 +1,10 @@
|
||||
import ServersService from '../services';
|
||||
import { LOAD_SERVER } from '../../reducers/types';
|
||||
import { LIST_SHORT_URLS } from '../../reducers/types';
|
||||
|
||||
export default function selectedServerReducer(state = null, action) {
|
||||
switch (action.type) {
|
||||
case LOAD_SERVER:
|
||||
case LIST_SHORT_URLS:
|
||||
return action.selectedServer;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
export const loadServer = serverId => {
|
||||
return {
|
||||
type: LOAD_SERVER,
|
||||
selectedServer: ServersService.findServerById(serverId),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
const PREFIX = 'shlink';
|
||||
const buildPath = path => `${PREFIX}.${path}`;
|
||||
import Storage from '../../utils/Storage';
|
||||
|
||||
export class ServersService {
|
||||
constructor(storage) {
|
||||
@@ -7,7 +6,7 @@ export class ServersService {
|
||||
}
|
||||
|
||||
listServers = () => {
|
||||
return JSON.parse(this.storage.getItem(buildPath('servers')) || '{}');
|
||||
return this.storage.get('servers');
|
||||
};
|
||||
|
||||
findServerById = serverId => {
|
||||
@@ -16,4 +15,4 @@ export class ServersService {
|
||||
}
|
||||
}
|
||||
|
||||
export default new ServersService(localStorage);
|
||||
export default new ServersService(Storage);
|
||||
|
||||
Reference in New Issue
Block a user