mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
Removed children from ShortUrlForm
This commit is contained in:
parent
ca670d810d
commit
1403538660
3 changed files with 19 additions and 19 deletions
|
@ -43,19 +43,20 @@ const CreateShortUrl = (ShortUrlForm: FC<ShortUrlFormProps>, CreateShortUrlResul
|
||||||
const initialState = useMemo(() => getInitialState(shortUrlCreationSettings), [ shortUrlCreationSettings ]);
|
const initialState = useMemo(() => getInitialState(shortUrlCreationSettings), [ shortUrlCreationSettings ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ShortUrlForm
|
<>
|
||||||
initialState={initialState}
|
<ShortUrlForm
|
||||||
saving={shortUrlCreationResult.saving}
|
initialState={initialState}
|
||||||
selectedServer={selectedServer}
|
saving={shortUrlCreationResult.saving}
|
||||||
mode={basicMode ? 'create-basic' : 'create'}
|
selectedServer={selectedServer}
|
||||||
onSave={createShortUrl}
|
mode={basicMode ? 'create-basic' : 'create'}
|
||||||
>
|
onSave={createShortUrl}
|
||||||
|
/>
|
||||||
<CreateShortUrlResult
|
<CreateShortUrlResult
|
||||||
{...shortUrlCreationResult}
|
{...shortUrlCreationResult}
|
||||||
resetCreateShortUrl={resetCreateShortUrl}
|
resetCreateShortUrl={resetCreateShortUrl}
|
||||||
canBeClosed={basicMode}
|
canBeClosed={basicMode}
|
||||||
/>
|
/>
|
||||||
</ShortUrlForm>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -71,18 +71,19 @@ export const EditShortUrl = (ShortUrlForm: FC<ShortUrlFormProps>) => ({
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ShortUrlForm
|
<>
|
||||||
initialState={getInitialState(shortUrl, shortUrlCreationSettings)}
|
<ShortUrlForm
|
||||||
saving={saving}
|
initialState={getInitialState(shortUrl, shortUrlCreationSettings)}
|
||||||
selectedServer={selectedServer}
|
saving={saving}
|
||||||
mode="edit"
|
selectedServer={selectedServer}
|
||||||
onSave={async (shortUrlData) => shortUrl && editShortUrl(shortUrl.shortCode, shortUrl.domain, shortUrlData)}
|
mode="edit"
|
||||||
>
|
onSave={async (shortUrlData) => shortUrl && editShortUrl(shortUrl.shortCode, shortUrl.domain, shortUrlData)}
|
||||||
|
/>
|
||||||
{savingError && (
|
{savingError && (
|
||||||
<Result type="error" className="mt-3">
|
<Result type="error" className="mt-3">
|
||||||
<ShlinkApiError errorData={savingErrorData} fallbackMessage="An error occurred while updating short URL :(" />
|
<ShlinkApiError errorData={savingErrorData} fallbackMessage="An error occurred while updating short URL :(" />
|
||||||
</Result>
|
</Result>
|
||||||
)}
|
)}
|
||||||
</ShortUrlForm>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,7 +39,7 @@ export const ShortUrlForm = (
|
||||||
TagsSelector: FC<TagsSelectorProps>,
|
TagsSelector: FC<TagsSelectorProps>,
|
||||||
ForServerVersion: FC<Versions>,
|
ForServerVersion: FC<Versions>,
|
||||||
DomainSelector: FC<DomainSelectorProps>,
|
DomainSelector: FC<DomainSelectorProps>,
|
||||||
): FC<ShortUrlFormProps> => ({ mode, saving, onSave, initialState, selectedServer, children }) => { // eslint-disable-line complexity
|
): FC<ShortUrlFormProps> => ({ mode, saving, onSave, initialState, selectedServer }) => { // eslint-disable-line complexity
|
||||||
const [ shortUrlData, setShortUrlData ] = useState(initialState);
|
const [ shortUrlData, setShortUrlData ] = useState(initialState);
|
||||||
const isEdit = mode === 'edit';
|
const isEdit = mode === 'edit';
|
||||||
const changeTags = (tags: string[]) => setShortUrlData({ ...shortUrlData, tags: tags.map(normalizeTag) });
|
const changeTags = (tags: string[]) => setShortUrlData({ ...shortUrlData, tags: tags.map(normalizeTag) });
|
||||||
|
@ -201,8 +201,6 @@ export const ShortUrlForm = (
|
||||||
{saving ? 'Saving...' : 'Save'}
|
{saving ? 'Saving...' : 'Save'}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{children}
|
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue