Fix:OPML file upload reset

This commit is contained in:
advplyr 2022-05-29 12:22:16 -05:00
parent cfcd351570
commit 6161daeef0

View File

@ -8,7 +8,7 @@
<ui-text-input v-model="searchInput" :disabled="processing" placeholder="Enter search term or RSS feed URL" class="flex-grow mr-2" /> <ui-text-input v-model="searchInput" :disabled="processing" placeholder="Enter search term or RSS feed URL" class="flex-grow mr-2" />
<ui-btn type="submit" :disabled="processing">Submit</ui-btn> <ui-btn type="submit" :disabled="processing">Submit</ui-btn>
</form> </form>
<ui-file-input :accept="'.opml, .txt'" class="mx-2" @change="opmlFileUpload"> Upload OPML File </ui-file-input> <ui-file-input ref="fileInput" :accept="'.opml, .txt'" class="mx-2" @change="opmlFileUpload"> Upload OPML File </ui-file-input>
</div> </div>
<div class="w-full max-w-3xl mx-auto py-4"> <div class="w-full max-w-3xl mx-auto py-4">
@ -86,6 +86,10 @@ export default {
reader.readAsText(file) reader.readAsText(file)
}) })
if (this.$refs.fileInput) {
this.$refs.fileInput.reset()
}
if (!txt || !txt.includes('<opml') || !txt.includes('<outline ')) { if (!txt || !txt.includes('<opml') || !txt.includes('<outline ')) {
// Quick lazy check for valid OPML // Quick lazy check for valid OPML
this.$toast.error('Invalid OPML file <opml> tag not found OR an <outline> tag was not found') this.$toast.error('Invalid OPML file <opml> tag not found OR an <outline> tag was not found')