Adding and updating Servers, fixes #524
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
|
||||
import { createRange } from '../../util/arrays';
|
||||
import { generateGuid } from '../../util/helpers';
|
||||
|
||||
export function set(data) {
|
||||
return {
|
||||
@ -15,6 +16,39 @@ export function updateServer(server) {
|
||||
};
|
||||
}
|
||||
|
||||
export function updateServers(servers) {
|
||||
return {
|
||||
type: 'MOPIDY_UPDATE_SERVERS',
|
||||
servers,
|
||||
};
|
||||
}
|
||||
|
||||
export function addServer() {
|
||||
return {
|
||||
type: 'MOPIDY_UPDATE_SERVER',
|
||||
server: {
|
||||
id: generateGuid(),
|
||||
name: 'New server',
|
||||
host: window.location.hostname,
|
||||
port: (window.location.port ? window.location.port : (window.location.protocol === 'https:' ? '443' : '80')),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function setCurrentServer(server) {
|
||||
return {
|
||||
type: 'MOPIDY_SET_CURRENT_SERVER',
|
||||
server,
|
||||
};
|
||||
}
|
||||
|
||||
export function removeServer(id) {
|
||||
return {
|
||||
type: 'MOPIDY_REMOVE_SERVER',
|
||||
id,
|
||||
};
|
||||
}
|
||||
|
||||
export function setConnection(data) {
|
||||
return {
|
||||
type: 'MOPIDY_SET_CONNECTION',
|
||||
|
||||
Reference in New Issue
Block a user