fix flow errors

This commit is contained in:
Sean Yesmunt 2019-10-08 15:03:09 -04:00
commit b459b3937e
3 changed files with 26 additions and 10 deletions

11
dist/bundle.es.js vendored
View file

@ -995,7 +995,9 @@ function parseURI(URL, requireProto = false) {
} }
if (channelName.length < channelNameMinLength) { if (channelName.length < channelNameMinLength) {
throw new Error(__(`Channel names must be at least %s characters.`, channelNameMinLength)); throw new Error(__(`Channel names must be at least %channelNameMinLength% characters.`, {
channelNameMinLength
}));
} }
} }
@ -1025,7 +1027,7 @@ function parseURIModifier(modSeperator, modValue) {
if (modSeperator) { if (modSeperator) {
if (!modValue) { if (!modValue) {
throw new Error(__(`No modifier provided after separator %s.`, modSeperator)); throw new Error(__(`No modifier provided after separator %modSeperator%.`, { modSeperator }));
} }
if (modSeperator === '#') { if (modSeperator === '#') {
@ -1038,7 +1040,7 @@ function parseURIModifier(modSeperator, modValue) {
} }
if (claimId && (claimId.length > claimIdMaxLength || !claimId.match(/^[0-9a-f]+$/))) { if (claimId && (claimId.length > claimIdMaxLength || !claimId.match(/^[0-9a-f]+$/))) {
throw new Error(__(`Invalid claim ID %s.`, claimId)); throw new Error(__(`Invalid claim ID %claimId%.`, { claimId }));
} }
if (claimSequence && !claimSequence.match(/^-?[1-9][0-9]*$/)) { if (claimSequence && !claimSequence.match(/^-?[1-9][0-9]*$/)) {
@ -1114,8 +1116,7 @@ function normalizeURI(URL) {
function isURIValid(URL) { function isURIValid(URL) {
try { try {
let parts = parseURI(normalizeURI(URL)); parseURI(normalizeURI(URL));
console.log('parts', parts);
} catch (error) { } catch (error) {
return false; return false;
} }

View file

@ -87,7 +87,11 @@ export function parseURI(URL: string, requireProto: boolean = false): LbryUrlObj
} }
if (channelName.length < channelNameMinLength) { if (channelName.length < channelNameMinLength) {
throw new Error(__(`Channel names must be at least %s characters.`, channelNameMinLength)); throw new Error(
__(`Channel names must be at least %channelNameMinLength% characters.`, {
channelNameMinLength,
})
);
} }
} }
@ -134,7 +138,7 @@ function parseURIModifier(modSeperator: ?string, modValue: ?string) {
if (modSeperator) { if (modSeperator) {
if (!modValue) { if (!modValue) {
throw new Error(__(`No modifier provided after separator %s.`, modSeperator)); throw new Error(__(`No modifier provided after separator %modSeperator%.`, { modSeperator }));
} }
if (modSeperator === '#') { if (modSeperator === '#') {
@ -147,7 +151,7 @@ function parseURIModifier(modSeperator: ?string, modValue: ?string) {
} }
if (claimId && (claimId.length > claimIdMaxLength || !claimId.match(/^[0-9a-f]+$/))) { if (claimId && (claimId.length > claimIdMaxLength || !claimId.match(/^[0-9a-f]+$/))) {
throw new Error(__(`Invalid claim ID %s.`, claimId)); throw new Error(__(`Invalid claim ID %claimId%.`, { claimId }));
} }
if (claimSequence && !claimSequence.match(/^-?[1-9][0-9]*$/)) { if (claimSequence && !claimSequence.match(/^-?[1-9][0-9]*$/)) {

View file

@ -237,7 +237,18 @@ export function doCreateChannel(name: string, amount: number, optionalParams: an
type: ACTIONS.CREATE_CHANNEL_STARTED, type: ACTIONS.CREATE_CHANNEL_STARTED,
}); });
const createParams = { const createParams: {
name: string,
bid: string,
blocking: true,
title?: string,
cover_url?: string,
thumbnail_url?: string,
description?: string,
website_url?: string,
email?: string,
tags?: Array<string>,
} = {
name, name,
bid: creditsToString(amount), bid: creditsToString(amount),
blocking: true, blocking: true,
@ -317,7 +328,7 @@ export function doUpdateChannel(params: any) {
updateParams.tags = params.tags.map(tag => tag.name); updateParams.tags = params.tags.map(tag => tag.name);
} }
//we'll need to remove these once we add locations/channels to channel page edit/create options // we'll need to remove these once we add locations/channels to channel page edit/create options
if (channelClaim && channelClaim.value && channelClaim.value.locations) { if (channelClaim && channelClaim.value && channelClaim.value.locations) {
updateParams.locations = channelClaim.value.locations; updateParams.locations = channelClaim.value.locations;