spee.ch/client/utils/validate.js
2018-03-16 10:34:26 -07:00

17 lines
496 B
JavaScript

export const validateChannelSelection = (publishInChannel, selectedChannel, loggedInChannel) => {
if (publishInChannel && (selectedChannel !== loggedInChannel.name)) {
throw new Error('Log in to a channel or select Anonymous');
}
};
export const validatePublishParams = (file, claim, urlError) => {
if (!file) {
throw new Error('Please choose a file');
}
if (!claim) {
throw new Error('Please enter a URL');
}
if (urlError) {
throw new Error('Fix the url');
}
};