summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorzephyr <[email protected]>2023-06-21 18:39:00 +0800
committerzephyr <[email protected]>2023-06-21 18:39:00 +0800
commit22629ccb97463f60721d4a8fdbb27dd76bde466f (patch)
tree9be83ea5cc6e48160404ed95f4d23f7462c4b1c5 /src/components
parent58d86c147440fa12d4f1c48c754efc2b273b48c1 (diff)
fix: push empty tag when init
Diffstat (limited to 'src/components')
-rw-r--r--src/components/Connections.tsx9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/components/Connections.tsx b/src/components/Connections.tsx
index b380ea1..77955c2 100644
--- a/src/components/Connections.tsx
+++ b/src/components/Connections.tsx
@@ -263,9 +263,16 @@ function Conn({ apiConfig }) {
const { t } = useTranslation();
const openModalSource = () => {
+ if (sourceMap.length === 0) {
+ sourceMap.push({
+ reg: '',
+ name: '',
+ });
+ }
setSourceMapModal(true);
};
const closeModalSource = () => {
+ setSourceMap(sourceMap.filter((i) => i.reg || i.name));
localStorage.setItem('sourceMap', JSON.stringify(sourceMap));
setSourceMapModal(false);
};
@@ -311,8 +318,8 @@ function Conn({ apiConfig }) {
</tr>
))}
</tbody>
- <Button onClick={() => sourceMap.push({ reg: '', name: '' })}>{t('add_tag')}</Button>
</table>
+ <Button onClick={() => sourceMap.push({ reg: '', name: '' })}>{t('add_tag')}</Button>
</BaseModal>
<div className={s.header}>
<ContentHeader title={t('Connections')} />