mirror of
https://github.com/jason5ng32/MyIP.git
synced 2026-11-04 08:55:47 +00:00
Fix(ui): an empty MAC Lookup submit clears the last answer
Returning early on empty input left the previous result and error on screen. It now clears them first, and the button stays disabled for a whitespace-only input. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0b4069b1b2
commit
a1bcc62965
1 file changed
+5
-4
@@ -18,7 +18,7 @@
|
||||
:placeholder="t('macchecker.Placeholder')"
|
||||
v-model="queryMAC" @keyup.enter="onSubmit" :aria-invalid="errorMsg !== ''" />
|
||||
<Button variant="action"
|
||||
:disabled="macCheckStatus === 'running' || !queryMAC"
|
||||
:disabled="macCheckStatus === 'running' || !queryMAC.trim()"
|
||||
@click="onSubmit" class="cursor-pointer">
|
||||
<Spinner v-if="macCheckStatus === 'running'" />
|
||||
<template v-else>
|
||||
@@ -178,11 +178,12 @@ const validateInput = (input) => {
|
||||
};
|
||||
|
||||
const onSubmit = () => {
|
||||
const raw = queryMAC.value.trim();
|
||||
if (!raw) return;
|
||||
trackEvent('Section', 'StartClick', 'MACChecker');
|
||||
errorMsg.value = '';
|
||||
macCheckResult.value = {};
|
||||
const raw = queryMAC.value.trim();
|
||||
// Empty input (Enter in a cleared field) just clears the last answer.
|
||||
if (!raw) return;
|
||||
trackEvent('Section', 'StartClick', 'MACChecker');
|
||||
picked.value = EXAMPLES.some((e) => e.input === raw) ? raw : '';
|
||||
const query = validateInput(raw);
|
||||
if (query) getMacInfo(query);
|
||||
|
||||
Reference in new issue
Block a user