mirror of
https://github.com/axllent/mailpit.git
synced 2025-07-03 00:46:58 +02:00
Chore: Apply linting to all JavaScript/Vue files with eslint & prettier
This commit is contained in:
@ -1,78 +1,84 @@
|
||||
<script>
|
||||
import CommonMixins from '../mixins/CommonMixins'
|
||||
import { pagination } from '../stores/pagination'
|
||||
import CommonMixins from "../mixins/CommonMixins";
|
||||
import { pagination } from "../stores/pagination";
|
||||
|
||||
export default {
|
||||
mixins: [CommonMixins],
|
||||
|
||||
emits: ['loadMessages'],
|
||||
emits: ["loadMessages"],
|
||||
|
||||
data() {
|
||||
return {
|
||||
search: ''
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.searchFromURL()
|
||||
search: "",
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
$route() {
|
||||
this.searchFromURL()
|
||||
}
|
||||
this.searchFromURL();
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.searchFromURL();
|
||||
},
|
||||
|
||||
methods: {
|
||||
searchFromURL() {
|
||||
const urlParams = new URLSearchParams(window.location.search)
|
||||
this.search = urlParams.get('q') ? urlParams.get('q') : ''
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
this.search = urlParams.get("q") ? urlParams.get("q") : "";
|
||||
},
|
||||
|
||||
doSearch(e) {
|
||||
pagination.start = 0
|
||||
if (this.search == '') {
|
||||
this.$router.push('/')
|
||||
pagination.start = 0;
|
||||
if (this.search === "") {
|
||||
this.$router.push("/");
|
||||
} else {
|
||||
const urlParams = new URLSearchParams(window.location.search)
|
||||
const curr = urlParams.get('q')
|
||||
if (curr && curr == this.search) {
|
||||
pagination.start = 0
|
||||
this.$emit('loadMessages')
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const curr = urlParams.get("q");
|
||||
if (curr && curr === this.search) {
|
||||
pagination.start = 0;
|
||||
this.$emit("loadMessages");
|
||||
}
|
||||
const p = {
|
||||
q: this.search
|
||||
}
|
||||
q: this.search,
|
||||
};
|
||||
if (pagination.start > 0) {
|
||||
p.start = pagination.start.toString()
|
||||
p.start = pagination.start.toString();
|
||||
}
|
||||
if (pagination.limit != pagination.defaultLimit) {
|
||||
p.limit = pagination.limit.toString()
|
||||
if (pagination.limit !== pagination.defaultLimit) {
|
||||
p.limit = pagination.limit.toString();
|
||||
}
|
||||
|
||||
const params = new URLSearchParams(p)
|
||||
this.$router.push('/search?' + params.toString())
|
||||
const params = new URLSearchParams(p);
|
||||
this.$router.push("/search?" + params.toString());
|
||||
}
|
||||
|
||||
e.preventDefault()
|
||||
e.preventDefault();
|
||||
},
|
||||
|
||||
resetSearch() {
|
||||
this.search = ''
|
||||
this.$router.push('/')
|
||||
}
|
||||
}
|
||||
}
|
||||
this.search = "";
|
||||
this.$router.push("/");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<form v-on:submit="doSearch">
|
||||
<form @submit="doSearch">
|
||||
<div class="input-group flex-nowrap">
|
||||
<div class="ms-md-2 d-flex border bg-body rounded-start flex-fill position-relative">
|
||||
<input type="text" class="form-control border-0" aria-label="Search" v-model.trim="search"
|
||||
placeholder="Search mailbox">
|
||||
<span class="btn btn-link position-absolute end-0 text-muted" v-if="search != ''"
|
||||
v-on:click="resetSearch"><i class="bi bi-x-circle"></i></span>
|
||||
<input
|
||||
v-model.trim="search"
|
||||
type="text"
|
||||
class="form-control border-0"
|
||||
aria-label="Search"
|
||||
placeholder="Search mailbox"
|
||||
/>
|
||||
<span v-if="search != ''" class="btn btn-link position-absolute end-0 text-muted" @click="resetSearch"
|
||||
><i class="bi bi-x-circle"></i
|
||||
></span>
|
||||
</div>
|
||||
<button class="btn btn-outline-secondary" type="submit">
|
||||
<i class="bi bi-search"></i>
|
||||
|
Reference in New Issue
Block a user