refactor: remove icons from toast

This commit is contained in:
liyasthomas
2021-11-19 21:13:58 +05:30
parent cad8f3e856
commit 26429466e9
58 changed files with 156 additions and 425 deletions

View File

@@ -313,7 +313,7 @@ pre.ace_editor {
&.toasted-primary { &.toasted-primary {
@apply bg-tooltip; @apply bg-tooltip;
@apply text-primary; @apply text-primary;
@apply justify-start; @apply justify-between;
@apply shadow; @apply shadow;
@apply font-medium; @apply font-medium;
@apply transition; @apply transition;

View File

@@ -160,12 +160,11 @@ onMounted(() => {
const cookiesAllowed = getLocalConfig("cookiesAllowed") === "yes" const cookiesAllowed = getLocalConfig("cookiesAllowed") === "yes"
if (!cookiesAllowed) { if (!cookiesAllowed) {
$toast.show(t("app.we_use_cookies").toString(), { $toast.show(`${t("app.we_use_cookies")}`, {
icon: "cookie",
duration: 0, duration: 0,
action: [ action: [
{ {
text: t("action.learn_more").toString(), text: `${t("action.learn_more")}`,
onClick: (_, toastObject) => { onClick: (_, toastObject) => {
setLocalConfig("cookiesAllowed", "yes") setLocalConfig("cookiesAllowed", "yes")
toastObject.goAway(0) toastObject.goAway(0)
@@ -173,7 +172,7 @@ onMounted(() => {
}, },
}, },
{ {
text: t("action.dismiss").toString(), text: `${t("action.dismiss")}`,
onClick: (_, toastObject) => { onClick: (_, toastObject) => {
setLocalConfig("cookiesAllowed", "yes") setLocalConfig("cookiesAllowed", "yes")
toastObject.goAway(0) toastObject.goAway(0)

View File

@@ -92,9 +92,7 @@ const platforms = [
const copyAppLink = () => { const copyAppLink = () => {
copyToClipboard(url) copyToClipboard(url)
copyIcon.value = "check" copyIcon.value = "check"
$toast.success(t("state.copied_to_clipboard").toString(), { $toast.success(`${t("state.copied_to_clipboard")}`)
icon: "content_paste",
})
setTimeout(() => (copyIcon.value = "copy"), 1000) setTimeout(() => (copyIcon.value = "copy"), 1000)
} }

View File

@@ -47,9 +47,7 @@ export default defineComponent({
methods: { methods: {
addNewCollection() { addNewCollection() {
if (!this.name) { if (!this.name) {
this.$toast.error(this.$t("collection.invalid_name"), { this.$toast.error(this.$t("collection.invalid_name"))
icon: "error_outline",
})
return return
} }
this.$emit("submit", this.name) this.$emit("submit", this.name)

View File

@@ -51,9 +51,7 @@ export default defineComponent({
methods: { methods: {
addFolder() { addFolder() {
if (!this.name) { if (!this.name) {
this.$toast.error(this.$t("folder.invalid_name"), { this.$toast.error(this.$t("folder.invalid_name"))
icon: "error_outline",
})
return return
} }
this.$emit("add-folder", { this.$emit("add-folder", {

View File

@@ -48,9 +48,7 @@ export default defineComponent({
methods: { methods: {
saveCollection() { saveCollection() {
if (!this.name) { if (!this.name) {
this.$toast.error(this.$t("collection.invalid_name"), { this.$toast.error(this.$t("collection.invalid_name"))
icon: "error_outline",
})
return return
} }
this.$emit("submit", this.name) this.$emit("submit", this.name)

View File

@@ -48,9 +48,7 @@ export default defineComponent({
methods: { methods: {
editFolder() { editFolder() {
if (!this.name) { if (!this.name) {
this.$toast.error(this.$t("folder.invalid_name"), { this.$toast.error(this.$t("folder.invalid_name"))
icon: "error_outline",
})
return return
} }
this.$emit("submit", this.name) this.$emit("submit", this.name)

View File

@@ -47,9 +47,7 @@ export default defineComponent({
methods: { methods: {
saveRequest() { saveRequest() {
if (!this.requestUpdateData.name) { if (!this.requestUpdateData.name) {
this.$toast.error(this.$t("request.invalid_name"), { this.$toast.error(this.$t("request.invalid_name"))
icon: "error_outline",
})
return return
} }
this.$emit("submit", this.requestUpdateData) this.$emit("submit", this.requestUpdateData)

View File

@@ -229,15 +229,11 @@ export default defineComponent({
} }
) )
.then((res) => { .then((res) => {
this.$toast.success(this.$t("export.gist_created"), { this.$toast.success(this.$t("export.gist_created"))
icon: "done",
})
window.open(res.html_url) window.open(res.html_url)
}) })
.catch((e) => { .catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
console.error(e) console.error(e)
}) })
}, },
@@ -415,23 +411,17 @@ export default defineComponent({
a.download = `${url.split("/").pop().split("#")[0].split("?")[0]}.json` a.download = `${url.split("/").pop().split("#")[0].split("?")[0]}.json`
document.body.appendChild(a) document.body.appendChild(a)
a.click() a.click()
this.$toast.success(this.$t("state.download_started"), { this.$toast.success(this.$t("state.download_started"))
icon: "downloading",
})
setTimeout(() => { setTimeout(() => {
document.body.removeChild(a) document.body.removeChild(a)
URL.revokeObjectURL(url) URL.revokeObjectURL(url)
}, 1000) }, 1000)
}, },
fileImported() { fileImported() {
this.$toast.success(this.$t("state.file_imported"), { this.$toast.success(this.$t("state.file_imported"))
icon: "folder_shared",
})
}, },
failedImport() { failedImport() {
this.$toast.error(this.$t("import.failed"), { this.$toast.error(this.$t("import.failed"))
icon: "error_outline",
})
}, },
parsePostmanCollection({ info, name, item }) { parsePostmanCollection({ info, name, item }) {
const hoppscotchCollection = { const hoppscotchCollection = {

View File

@@ -194,15 +194,11 @@ const hideModal = () => {
const saveRequestAs = async () => { const saveRequestAs = async () => {
if (!requestName.value) { if (!requestName.value) {
$toast.error(`${t("error.empty_req_name")}`, { $toast.error(`${t("error.empty_req_name")}`)
icon: "error_outline",
})
return return
} }
if (picked.value === null) { if (picked.value === null) {
$toast.error(`${t("collection.select")}`, { $toast.error(`${t("collection.select")}`)
icon: "error_outline",
})
return return
} }
@@ -283,9 +279,7 @@ const saveRequestAs = async () => {
requestSaved() requestSaved()
}) })
.catch((error) => { .catch((error) => {
$toast.error(t("profile.no_permission").toString(), { $toast.error(`${t("profile.no_permission")}`)
icon: "error_outline",
})
throw new Error(error) throw new Error(error)
}) })
@@ -320,9 +314,7 @@ const saveRequestAs = async () => {
requestSaved() requestSaved()
} catch (error) { } catch (error) {
$toast.error(t("profile.no_permission").toString(), { $toast.error(`${t("profile.no_permission")}`)
icon: "error_outline",
})
console.error(error) console.error(error)
} }
} else if (picked.value.pickedType === "teams-collection") { } else if (picked.value.pickedType === "teams-collection") {
@@ -352,9 +344,7 @@ const saveRequestAs = async () => {
requestSaved() requestSaved()
} catch (error) { } catch (error) {
$toast.error(t("profile.no_permission").toString(), { $toast.error(`${t("profile.no_permission")}`)
icon: "error_outline",
})
console.error(error) console.error(error)
} }
} else if (picked.value.pickedType === "gql-my-request") { } else if (picked.value.pickedType === "gql-my-request") {
@@ -386,9 +376,7 @@ const saveRequestAs = async () => {
} }
const requestSaved = () => { const requestSaved = () => {
$toast.success(`${t("request.added")}`, { $toast.success(`${t("request.added")}`)
icon: "post_add",
})
hideModal() hideModal()
} }

View File

@@ -49,9 +49,7 @@ export default defineComponent({
methods: { methods: {
addNewCollection() { addNewCollection() {
if (!this.name) { if (!this.name) {
this.$toast.error(`${this.$t("collection.invalid_name")}`, { this.$toast.error(`${this.$t("collection.invalid_name")}`)
icon: "error_outline",
})
return return
} }

View File

@@ -251,9 +251,7 @@ export default defineComponent({
this.$emit("select", { picked: null }) this.$emit("select", { picked: null })
} }
removeGraphqlCollection(this.collectionIndex) removeGraphqlCollection(this.collectionIndex)
this.$toast.success(`${this.$t("state.deleted")}`, { this.$toast.success(`${this.$t("state.deleted")}`)
icon: "delete",
})
}, },
dropEvent({ dataTransfer }: any) { dropEvent({ dataTransfer }: any) {
this.dragging = !this.dragging this.dragging = !this.dragging

View File

@@ -54,9 +54,7 @@ export default defineComponent({
methods: { methods: {
saveCollection() { saveCollection() {
if (!this.name) { if (!this.name) {
this.$toast.error(`${this.$t("collection.invalid_name")}`, { this.$toast.error(`${this.$t("collection.invalid_name")}`)
icon: "error_outline",
})
return return
} }
const collectionUpdated = { const collectionUpdated = {

View File

@@ -54,9 +54,7 @@ export default defineComponent({
methods: { methods: {
editFolder() { editFolder() {
if (!this.name) { if (!this.name) {
this.$toast.error(`${this.$t("collection.invalid_name")}`, { this.$toast.error(`${this.$t("collection.invalid_name")}`)
icon: "error_outline",
})
return return
} }
editGraphqlFolder(this.folderPath, { editGraphqlFolder(this.folderPath, {

View File

@@ -58,9 +58,7 @@ export default defineComponent({
methods: { methods: {
saveRequest() { saveRequest() {
if (!this.requestUpdateData.name) { if (!this.requestUpdateData.name) {
this.$toast.error(`${this.$t("collection.invalid_name")}`, { this.$toast.error(`${this.$t("collection.invalid_name")}`)
icon: "error_outline",
})
return return
} }
const requestUpdated = { const requestUpdated = {

View File

@@ -250,9 +250,7 @@ export default defineComponent({
} }
removeGraphqlFolder(this.folderPath) removeGraphqlFolder(this.folderPath)
this.$toast.success(`${this.$t("state.deleted")}`, { this.$toast.success(`${this.$t("state.deleted")}`)
icon: "delete",
})
}, },
dropEvent({ dataTransfer }: any) { dropEvent({ dataTransfer }: any) {
this.dragging = !this.dragging this.dragging = !this.dragging

View File

@@ -140,15 +140,11 @@ export default defineComponent({
} }
) )
.then((res) => { .then((res) => {
this.$toast.success(this.$t("export.gist_created"), { this.$toast.success(this.$t("export.gist_created"))
icon: "done",
})
window.open(res.html_url) window.open(res.html_url)
}) })
.catch((e) => { .catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
console.error(e) console.error(e)
}) })
}, },
@@ -252,23 +248,17 @@ export default defineComponent({
a.download = `${url.split("/").pop().split("#")[0].split("?")[0]}.json` a.download = `${url.split("/").pop().split("#")[0].split("?")[0]}.json`
document.body.appendChild(a) document.body.appendChild(a)
a.click() a.click()
this.$toast.success(this.$t("state.download_started"), { this.$toast.success(this.$t("state.download_started"))
icon: "downloading",
})
setTimeout(() => { setTimeout(() => {
document.body.removeChild(a) document.body.removeChild(a)
URL.revokeObjectURL(url) URL.revokeObjectURL(url)
}, 1000) }, 1000)
}, },
fileImported() { fileImported() {
this.$toast.success(this.$t("state.file_imported"), { this.$toast.success(this.$t("state.file_imported"))
icon: "folder_shared",
})
}, },
failedImport() { failedImport() {
this.$toast.error(this.$t("import.failed"), { this.$toast.error(this.$t("import.failed"))
icon: "error_outline",
})
}, },
parsePostmanCollection({ info, name, item }) { parsePostmanCollection({ info, name, item }) {
const hoppscotchCollection = { const hoppscotchCollection = {

View File

@@ -194,9 +194,7 @@ export default defineComponent({
} }
removeGraphqlRequest(this.folderPath, this.requestIndex) removeGraphqlRequest(this.folderPath, this.requestIndex)
this.$toast.success(`${this.$t("state.deleted")}`, { this.$toast.success(`${this.$t("state.deleted")}`)
icon: "delete",
})
}, },
}, },
}) })

View File

@@ -361,14 +361,10 @@ export default defineComponent({
this.collectionsType.selectedTeam.id this.collectionsType.selectedTeam.id
) )
.then(() => { .then(() => {
this.$toast.success(this.$t("collection.created"), { this.$toast.success(this.$t("collection.created"))
icon: "done",
})
}) })
.catch((e) => { .catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
console.error(e) console.error(e)
}) })
} }
@@ -377,9 +373,7 @@ export default defineComponent({
// Intented to be called by CollectionEdit modal submit event // Intented to be called by CollectionEdit modal submit event
updateEditingCollection(newName) { updateEditingCollection(newName) {
if (!newName) { if (!newName) {
this.$toast.error(this.$t("collection.invalid_name"), { this.$toast.error(this.$t("collection.invalid_name"))
icon: "error_outline",
})
return return
} }
if (this.collectionsType.type === "my-collections") { if (this.collectionsType.type === "my-collections") {
@@ -396,14 +390,10 @@ export default defineComponent({
teamUtils teamUtils
.renameCollection(this.$apollo, newName, this.editingCollection.id) .renameCollection(this.$apollo, newName, this.editingCollection.id)
.then(() => { .then(() => {
this.$toast.success(this.$t("collection.renamed"), { this.$toast.success(this.$t("collection.renamed"))
icon: "done",
})
}) })
.catch((e) => { .catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
console.error(e) console.error(e)
}) })
} }
@@ -420,14 +410,10 @@ export default defineComponent({
teamUtils teamUtils
.renameCollection(this.$apollo, name, this.editingFolder.id) .renameCollection(this.$apollo, name, this.editingFolder.id)
.then(() => { .then(() => {
this.$toast.success(this.$t("folder.renamed"), { this.$toast.success(this.$t("folder.renamed"))
icon: "done",
})
}) })
.catch((e) => { .catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
console.error(e) console.error(e)
}) })
} }
@@ -460,15 +446,11 @@ export default defineComponent({
this.editingRequestIndex this.editingRequestIndex
) )
.then(() => { .then(() => {
this.$toast.success(this.$t("request.renamed"), { this.$toast.success(this.$t("request.renamed"))
icon: "done",
})
this.$emit("update-team-collections") this.$emit("update-team-collections")
}) })
.catch((e) => { .catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
console.error(e) console.error(e)
}) })
} }
@@ -533,15 +515,11 @@ export default defineComponent({
}, },
}) })
.then(() => { .then(() => {
this.$toast.success(this.$t("folder.created"), { this.$toast.success(this.$t("folder.created"))
icon: "done",
})
this.$emit("update-team-collections") this.$emit("update-team-collections")
}) })
.catch((e) => { .catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
console.error(e) console.error(e)
}) })
} }
@@ -605,9 +583,7 @@ export default defineComponent({
} }
removeRESTCollection(collectionIndex) removeRESTCollection(collectionIndex)
this.$toast.success(this.$t("state.deleted"), { this.$toast.success(this.$t("state.deleted"))
icon: "delete",
})
} else if (collectionsType.type === "team-collections") { } else if (collectionsType.type === "team-collections") {
// Cancel pick if picked collection is deleted // Cancel pick if picked collection is deleted
if ( if (
@@ -633,14 +609,10 @@ export default defineComponent({
}, },
}) })
.then(() => { .then(() => {
this.$toast.success(this.$t("state.deleted"), { this.$toast.success(this.$t("state.deleted"))
icon: "delete",
})
}) })
.catch((e) => { .catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
console.error(e) console.error(e)
}) })
} }
@@ -658,9 +630,7 @@ export default defineComponent({
this.$emit("select", { picked: null }) this.$emit("select", { picked: null })
} }
removeRESTRequest(folderPath, requestIndex) removeRESTRequest(folderPath, requestIndex)
this.$toast.success(this.$t("state.deleted"), { this.$toast.success(this.$t("state.deleted"))
icon: "delete",
})
} else if (this.collectionsType.type === "team-collections") { } else if (this.collectionsType.type === "team-collections") {
// Cancel pick if the picked item is being deleted // Cancel pick if the picked item is being deleted
if ( if (
@@ -674,14 +644,10 @@ export default defineComponent({
teamUtils teamUtils
.deleteRequest(this.$apollo, requestIndex) .deleteRequest(this.$apollo, requestIndex)
.then(() => { .then(() => {
this.$toast.success(this.$t("state.deleted"), { this.$toast.success(this.$t("state.deleted"))
icon: "delete",
})
}) })
.catch((e) => { .catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
console.error(e) console.error(e)
}) })
} }

View File

@@ -262,9 +262,7 @@ export default defineComponent({
this.$emit("select", { picked: null }) this.$emit("select", { picked: null })
} }
removeRESTFolder(this.folderPath) removeRESTFolder(this.folderPath)
this.$toast.success(this.$t("state.deleted"), { this.$toast.success(this.$t("state.deleted"))
icon: "delete",
})
}, },
dropEvent({ dataTransfer }) { dropEvent({ dataTransfer }) {
this.dragging = !this.dragging this.dragging = !this.dragging

View File

@@ -253,15 +253,11 @@ export default defineComponent({
teamUtils teamUtils
.deleteCollection(this.$apollo, this.folder.id) .deleteCollection(this.$apollo, this.folder.id)
.then(() => { .then(() => {
this.$toast.success(this.$t("state.deleted"), { this.$toast.success(this.$t("state.deleted"))
icon: "delete",
})
this.$emit("update-team-collections") this.$emit("update-team-collections")
}) })
.catch((e) => { .catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
console.error(e) console.error(e)
}) })
this.$emit("update-team-collections") this.$emit("update-team-collections")

View File

@@ -52,9 +52,7 @@ export default defineComponent({
methods: { methods: {
addNewEnvironment() { addNewEnvironment() {
if (!this.name) { if (!this.name) {
this.$toast.error(`${this.$t("environment.invalid_name")}`, { this.$toast.error(`${this.$t("environment.invalid_name")}`)
icon: "error_outline",
})
return return
} }
createEnvironment(this.name) createEnvironment(this.name)

View File

@@ -177,9 +177,7 @@ export default defineComponent({
clearContent() { clearContent() {
this.vars = [] this.vars = []
this.clearIcon = "check" this.clearIcon = "check"
this.$toast.success(`${this.$t("state.cleared")}`, { this.$toast.success(`${this.$t("state.cleared")}`)
icon: "clear_all",
})
setTimeout(() => (this.clearIcon = "trash-2"), 1000) setTimeout(() => (this.clearIcon = "trash-2"), 1000)
}, },
addEnvironmentVariable() { addEnvironmentVariable() {
@@ -193,9 +191,7 @@ export default defineComponent({
}, },
saveEnvironment() { saveEnvironment() {
if (!this.name) { if (!this.name) {
this.$toast.error(`${this.$t("environment.invalid_name")}`, { this.$toast.error(`${this.$t("environment.invalid_name")}`)
icon: "error_outline",
})
return return
} }

View File

@@ -102,9 +102,7 @@ export default defineComponent({
removeEnvironment() { removeEnvironment() {
if (this.environmentIndex !== "Global") if (this.environmentIndex !== "Global")
deleteEnvironment(this.environmentIndex) deleteEnvironment(this.environmentIndex)
this.$toast.success(`${this.$t("state.deleted")}`, { this.$toast.success(`${this.$t("state.deleted")}`)
icon: "delete",
})
}, },
duplicateEnvironment() { duplicateEnvironment() {
if (this.environmentIndex === "Global") { if (this.environmentIndex === "Global") {

View File

@@ -140,15 +140,11 @@ export default defineComponent({
} }
) )
.then((res) => { .then((res) => {
this.$toast.success(this.$t("export.gist_created"), { this.$toast.success(this.$t("export.gist_created"))
icon: "done",
})
window.open(res.html_url) window.open(res.html_url)
}) })
.catch((e) => { .catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
console.error(e) console.error(e)
}) })
}, },
@@ -230,18 +226,14 @@ export default defineComponent({
a.download = `${url.split("/").pop().split("#")[0].split("?")[0]}.json` a.download = `${url.split("/").pop().split("#")[0].split("?")[0]}.json`
document.body.appendChild(a) document.body.appendChild(a)
a.click() a.click()
this.$toast.success(this.$t("state.download_started"), { this.$toast.success(this.$t("state.download_started"))
icon: "downloading",
})
setTimeout(() => { setTimeout(() => {
document.body.removeChild(a) document.body.removeChild(a)
URL.revokeObjectURL(url) URL.revokeObjectURL(url)
}, 1000) }, 1000)
}, },
fileImported() { fileImported() {
this.$toast.success(this.$t("state.file_imported"), { this.$toast.success(this.$t("state.file_imported"))
icon: "folder_shared",
})
}, },
}, },
}) })

View File

@@ -155,9 +155,7 @@ export default defineComponent({
}, },
methods: { methods: {
showLoginSuccess() { showLoginSuccess() {
this.$toast.success(`${this.$t("auth.login_success")}`, { this.$toast.success(`${this.$t("auth.login_success")}`)
icon: "vpn_key",
})
}, },
async signInWithGoogle() { async signInWithGoogle() {
this.signingInWithGoogle = true this.signingInWithGoogle = true
@@ -174,7 +172,6 @@ export default defineComponent({
// The pending Google credential. // The pending Google credential.
const pendingCred = e.credential const pendingCred = e.credential
this.$toast.info(`${this.$t("auth.account_exists")}`, { this.$toast.info(`${this.$t("auth.account_exists")}`, {
icon: "vpn_key",
duration: 0, duration: 0,
closeOnSwipe: false, closeOnSwipe: false,
action: { action: {
@@ -190,9 +187,7 @@ export default defineComponent({
}, },
}) })
} else { } else {
this.$toast.error(`${this.$t("error.something_went_wrong")}`, { this.$toast.error(`${this.$t("error.something_went_wrong")}`)
icon: "error_outline",
})
} }
} }
@@ -218,7 +213,6 @@ export default defineComponent({
// The pending Google credential. // The pending Google credential.
const pendingCred = e.credential const pendingCred = e.credential
this.$toast.info(`${this.$t("auth.account_exists")}`, { this.$toast.info(`${this.$t("auth.account_exists")}`, {
icon: "vpn_key",
duration: 0, duration: 0,
closeOnSwipe: false, closeOnSwipe: false,
action: { action: {
@@ -234,9 +228,7 @@ export default defineComponent({
}, },
}) })
} else { } else {
this.$toast.error(`${this.$t("error.something_went_wrong")}`, { this.$toast.error(`${this.$t("error.something_went_wrong")}`)
icon: "error_outline",
})
} }
} }
@@ -256,9 +248,7 @@ export default defineComponent({
}) })
.catch((e) => { .catch((e) => {
console.error(e) console.error(e)
this.$toast.error(e.message, { this.$toast.error(e.message)
icon: "error_outline",
})
this.signingInWithEmail = false this.signingInWithEmail = false
}) })
.finally(() => { .finally(() => {

View File

@@ -40,14 +40,10 @@ export default defineComponent({
async logout() { async logout() {
try { try {
await signOutUser() await signOutUser()
this.$toast.success(`${this.$t("auth.logged_out")}`, { this.$toast.success(`${this.$t("auth.logged_out")}`)
icon: "vpn_key",
})
} catch (e) { } catch (e) {
console.error(e) console.error(e)
this.$toast.error(`${this.$t("error.something_went_wrong")}`, { this.$toast.error(`${this.$t("error.something_went_wrong")}`)
icon: "error_outline",
})
} }
}, },
}, },

View File

@@ -337,9 +337,7 @@ watch(bulkHeaders, () => {
})) }))
setGQLHeaders(transformation as GQLHeader[]) setGQLHeaders(transformation as GQLHeader[])
} catch (e) { } catch (e) {
$toast.error(`${t("error.something_went_wrong")}`, { $toast.error(`${t("error.something_went_wrong")}`)
icon: "error_outline",
})
console.error(e) console.error(e)
} }
}) })
@@ -428,6 +426,7 @@ onMounted(() => {
const copyQuery = () => { const copyQuery = () => {
copyToClipboard(gqlQueryString.value) copyToClipboard(gqlQueryString.value)
copyQueryIcon.value = "check" copyQueryIcon.value = "check"
$toast.success(`${t("state.copied_to_clipboard")}`)
setTimeout(() => (copyQueryIcon.value = "copy"), 1000) setTimeout(() => (copyQueryIcon.value = "copy"), 1000)
} }
@@ -471,18 +470,14 @@ const runQuery = async () => {
}) })
) )
$toast.success(`${t("state.finished_in", { duration })}`, { $toast.success(`${t("state.finished_in", { duration })}`)
icon: "done",
})
} catch (e: any) { } catch (e: any) {
response.value = `${e}` response.value = `${e}`
nuxt.value.$loading.finish() nuxt.value.$loading.finish()
$toast.error( $toast.error(
`${t("error.something_went_wrong")}. ${t("error.check_console_details")}`, `${t("error.something_went_wrong")}. ${t("error.check_console_details")}`,
{ {}
icon: "error_outline",
}
) )
console.error(e) console.error(e)
} }
@@ -500,12 +495,11 @@ const hideRequestModal = () => {
const prettifyQuery = () => { const prettifyQuery = () => {
try { try {
gqlQueryString.value = gql.print(gql.parse(gqlQueryString.value)) gqlQueryString.value = gql.print(gql.parse(gqlQueryString.value))
} catch (e) {
$toast.error(`${t("error.gql_prettify_invalid_query")}`, {
icon: "error_outline",
})
}
prettifyQueryIcon.value = "check" prettifyQueryIcon.value = "check"
} catch (e) {
$toast.error(`${t("error.gql_prettify_invalid_query")}`)
prettifyQueryIcon.value = "info"
}
setTimeout(() => (prettifyQueryIcon.value = "wand"), 1000) setTimeout(() => (prettifyQueryIcon.value = "wand"), 1000)
} }
@@ -516,6 +510,7 @@ const saveRequest = () => {
const copyVariables = () => { const copyVariables = () => {
copyToClipboard(variableString.value) copyToClipboard(variableString.value)
copyVariablesIcon.value = "check" copyVariablesIcon.value = "check"
$toast.success(`${t("state.copied_to_clipboard")}`)
setTimeout(() => (copyVariablesIcon.value = "copy"), 1000) setTimeout(() => (copyVariablesIcon.value = "copy"), 1000)
} }
@@ -543,11 +538,10 @@ const removeRequestHeader = (index: number) => {
const deletedItem = headersBeforeDeletion[index] const deletedItem = headersBeforeDeletion[index]
if (deletedItem.key || deletedItem.value) { if (deletedItem.key || deletedItem.value) {
$toast.success(t("state.deleted").toString(), { $toast.success(`${t("state.deleted")}`, {
icon: "delete",
action: [ action: [
{ {
text: t("action.undo").toString(), text: `${t("action.undo")}`,
onClick: (_, toastObject) => { onClick: (_, toastObject) => {
setGQLHeaders(headersBeforeDeletion as GQLHeader[]) setGQLHeaders(headersBeforeDeletion as GQLHeader[])
editBulkHeadersLine(index, deletedItem) editBulkHeadersLine(index, deletedItem)

View File

@@ -128,6 +128,7 @@ const copyResponseIcon = ref("copy")
const copyResponse = () => { const copyResponse = () => {
copyToClipboard(responseString.value!) copyToClipboard(responseString.value!)
copyResponseIcon.value = "check" copyResponseIcon.value = "check"
$toast.success(`${t("state.copied_to_clipboard")}`)
setTimeout(() => (copyResponseIcon.value = "copy"), 1000) setTimeout(() => (copyResponseIcon.value = "copy"), 1000)
} }
@@ -141,9 +142,7 @@ const downloadResponse = () => {
document.body.appendChild(a) document.body.appendChild(a)
a.click() a.click()
downloadResponseIcon.value = "check" downloadResponseIcon.value = "check"
$toast.success(`${t("state.download_started")}`, { $toast.success(`${t("state.download_started")}`)
icon: "downloading",
})
setTimeout(() => { setTimeout(() => {
document.body.removeChild(a) document.body.removeChild(a)
URL.revokeObjectURL(url) URL.revokeObjectURL(url)

View File

@@ -449,9 +449,7 @@ const downloadSchema = () => {
document.body.appendChild(a) document.body.appendChild(a)
a.click() a.click()
downloadSchemaIcon.value = "check" downloadSchemaIcon.value = "check"
$toast.success(`${t("state.download_started")}`, { $toast.success(`${t("state.download_started")}`)
icon: "downloading",
})
setTimeout(() => { setTimeout(() => {
document.body.removeChild(a) document.body.removeChild(a)
URL.revokeObjectURL(url) URL.revokeObjectURL(url)

View File

@@ -140,9 +140,7 @@ export default defineComponent({
clearHistory() { clearHistory() {
if (this.page === "rest") clearRESTHistory() if (this.page === "rest") clearRESTHistory()
else clearGraphqlHistory() else clearGraphqlHistory()
this.$toast.success(`${this.$t("state.history_deleted")}`, { this.$toast.success(`${this.$t("state.history_deleted")}`)
icon: "delete",
})
}, },
useHistory(entry: any) { useHistory(entry: any) {
if (this.page === "rest") setRESTRequest(entry.request) if (this.page === "rest") setRESTRequest(entry.request)
@@ -150,9 +148,7 @@ export default defineComponent({
deleteHistory(entry: any) { deleteHistory(entry: any) {
if (this.page === "rest") deleteRESTHistoryEntry(entry) if (this.page === "rest") deleteRESTHistoryEntry(entry)
else deleteGraphqlHistoryEntry(entry) else deleteGraphqlHistoryEntry(entry)
this.$toast.success(`${this.$t("state.deleted")}`, { this.$toast.success(`${this.$t("state.deleted")}`)
icon: "delete",
})
}, },
toggleStar(entry: any) { toggleStar(entry: any) {
if (this.page === "rest") toggleRESTHistoryEntryStar(entry) if (this.page === "rest") toggleRESTHistoryEntryStar(entry)

View File

@@ -126,9 +126,7 @@ const hideModal = () => emit("hide-modal")
const copyRequestCode = () => { const copyRequestCode = () => {
copyToClipboard(requestCode.value) copyToClipboard(requestCode.value)
copyIcon.value = "check" copyIcon.value = "check"
$toast.success(`${t("state.copied_to_clipboard")}`, { $toast.success(`${t("state.copied_to_clipboard")}`)
icon: "content_paste",
})
setTimeout(() => (copyIcon.value = "copy"), 1000) setTimeout(() => (copyIcon.value = "copy"), 1000)
} }
</script> </script>

View File

@@ -214,9 +214,7 @@ watch(bulkHeaders, () => {
})) }))
setRESTHeaders(transformation as HoppRESTHeader[]) setRESTHeaders(transformation as HoppRESTHeader[])
} catch (e) { } catch (e) {
$toast.error(`${t("error.something_went_wrong")}`, { $toast.error(`${t("error.something_went_wrong")}`)
icon: "error_outline",
})
console.error(e) console.error(e)
} }
}) })
@@ -278,11 +276,10 @@ const deleteHeader = (index: number) => {
const deletedItem = headersBeforeDeletion[index] const deletedItem = headersBeforeDeletion[index]
if (deletedItem.key || deletedItem.value) { if (deletedItem.key || deletedItem.value) {
$toast.success(t("state.deleted").toString(), { $toast.success(`${t("state.deleted")}`, {
icon: "delete",
action: [ action: [
{ {
text: t("action.undo").toString(), text: `${t("action.undo")}`,
onClick: (_, toastObject) => { onClick: (_, toastObject) => {
setRESTHeaders(headersBeforeDeletion as HoppRESTHeader[]) setRESTHeaders(headersBeforeDeletion as HoppRESTHeader[])
editBulkHeadersLine(index, deletedItem) editBulkHeadersLine(index, deletedItem)

View File

@@ -123,9 +123,7 @@ const handleImport = () => {
) )
} catch (e) { } catch (e) {
console.error(e) console.error(e)
$toast.error(`${t("error.curl_invalid_format")}`, { $toast.error(`${t("error.curl_invalid_format")}`)
icon: "error_outline",
})
} }
hideModal() hideModal()
} }

View File

@@ -97,9 +97,7 @@ export default {
oidcDiscoveryURL.value === "" && oidcDiscoveryURL.value === "" &&
(authURL.value === "" || accessTokenURL.value === "") (authURL.value === "" || accessTokenURL.value === "")
) { ) {
$toast.error(`${$t("complete_config_urls")}`, { $toast.error(`${$t("complete_config_urls")}`)
icon: "error",
})
return return
} }
try { try {
@@ -113,9 +111,7 @@ export default {
} }
await tokenRequest(tokenReqParams) await tokenRequest(tokenReqParams)
} catch (e) { } catch (e) {
$toast.error(`${e}`, { $toast.error(`${e}`)
icon: "code",
})
} }
} }

View File

@@ -196,9 +196,7 @@ watch(bulkParams, () => {
})) }))
setRESTParams(transformation as HoppRESTParam[]) setRESTParams(transformation as HoppRESTParam[])
} catch (e) { } catch (e) {
$toast.error(`${t("error.something_went_wrong")}`, { $toast.error(`${t("error.something_went_wrong")}`)
icon: "error_outline",
})
console.error(e) console.error(e)
} }
}) })
@@ -271,11 +269,10 @@ const deleteParam = (index: number) => {
const deletedItem = parametersBeforeDeletion[index] const deletedItem = parametersBeforeDeletion[index]
if (deletedItem.key || deletedItem.value) { if (deletedItem.key || deletedItem.value) {
$toast.success(t("state.deleted").toString(), { $toast.success(`${t("state.deleted")}`, {
icon: "delete",
action: [ action: [
{ {
text: t("action.undo").toString(), text: `${t("action.undo")}`,
onClick: (_, toastObject) => { onClick: (_, toastObject) => {
setRESTParams(parametersBeforeDeletion as HoppRESTParam[]) setRESTParams(parametersBeforeDeletion as HoppRESTParam[])
editBulkParamsLine(index, deletedItem) editBulkParamsLine(index, deletedItem)

View File

@@ -118,13 +118,9 @@ const uploadPayload = (e: InputEvent) => {
rawParamsBody.value = target?.result rawParamsBody.value = target?.result
} }
reader.readAsText(file) reader.readAsText(file)
$toast.success(`${t("state.file_imported")}`, { $toast.success(`${t("state.file_imported")}`)
icon: "attach_file",
})
} else { } else {
$toast.error(`${t("action.choose_file")}`, { $toast.error(`${t("action.choose_file")}`)
icon: "attach_file",
})
} }
} }
const prettifyRequestBody = () => { const prettifyRequestBody = () => {
@@ -135,9 +131,7 @@ const prettifyRequestBody = () => {
setTimeout(() => (prettifyIcon.value = "wand"), 1000) setTimeout(() => (prettifyIcon.value = "wand"), 1000)
} catch (e) { } catch (e) {
console.error(e) console.error(e)
$toast.error(`${t("error.json_prettify_invalid_body")}`, { $toast.error(`${t("error.json_prettify_invalid_body")}`)
icon: "error_outline",
})
} }
} }
</script> </script>

View File

@@ -341,9 +341,7 @@ const copyRequest = () => {
.catch(() => {}) .catch(() => {})
} else { } else {
copyToClipboard(window.location.href) copyToClipboard(window.location.href)
$toast.success(`${t("state.copied_to_clipboard")}`, { $toast.success(`${t("state.copied_to_clipboard")}`)
icon: "content_paste",
})
} }
} }
@@ -382,9 +380,7 @@ const saveRequest = () => {
if (saveCtx.originLocation === "user-collection") { if (saveCtx.originLocation === "user-collection") {
editRESTRequest(saveCtx.folderPath, saveCtx.requestIndex, getRESTRequest()) editRESTRequest(saveCtx.folderPath, saveCtx.requestIndex, getRESTRequest())
$toast.success(`${t("request.saved")}`, { $toast.success(`${t("request.saved")}`)
icon: "playlist_add_check",
})
} else if (saveCtx.originLocation === "team-collection") { } else if (saveCtx.originLocation === "team-collection") {
const req = getRESTRequest() const req = getRESTRequest()
@@ -397,20 +393,14 @@ const saveRequest = () => {
saveCtx.requestID saveCtx.requestID
) )
.then(() => { .then(() => {
$toast.success(`${t("request.saved")}`, { $toast.success(`${t("request.saved")}`)
icon: "playlist_add_check",
})
}) })
.catch(() => { .catch(() => {
$toast.error(t("profile.no_permission").toString(), { $toast.error(`${t("profile.no_permission")}`)
icon: "error_outline",
})
}) })
} catch (error) { } catch (error) {
showSaveRequestModal.value = true showSaveRequestModal.value = true
$toast.error(t("error.something_went_wrong").toString(), { $toast.error(`${t("error.something_went_wrong")}`)
icon: "error_outline",
})
console.error(error) console.error(error)
} }
} }

View File

@@ -73,7 +73,7 @@
w-32 w-32
inline-flex inline-flex
" "
:alt="$t('empty.network_fail')" :alt="$t('error.network_fail')"
/> />
<span class="text-center font-semibold mb-2"> <span class="text-center font-semibold mb-2">
{{ $t("error.network_fail") }} {{ $t("error.network_fail") }}

View File

@@ -89,9 +89,7 @@ const copyIcon = ref("copy")
const copyHeaders = () => { const copyHeaders = () => {
copyToClipboard(JSON.stringify(props.headers)) copyToClipboard(JSON.stringify(props.headers))
copyIcon.value = "check" copyIcon.value = "check"
$toast.success(t("state.copied_to_clipboard").toString(), { $toast.success(`${t("state.copied_to_clipboard")}`)
icon: "content_paste",
})
setTimeout(() => (copyIcon.value = "copy"), 1000) setTimeout(() => (copyIcon.value = "copy"), 1000)
} }
</script> </script>

View File

@@ -127,9 +127,7 @@ const downloadResponse = () => {
document.body.appendChild(a) document.body.appendChild(a)
a.click() a.click()
downloadIcon.value = "check" downloadIcon.value = "check"
$toast.success(`${t("state.download_started")}`, { $toast.success(`${t("state.download_started")}`)
icon: "downloading",
})
setTimeout(() => { setTimeout(() => {
document.body.removeChild(a) document.body.removeChild(a)
URL.revokeObjectURL(url) URL.revokeObjectURL(url)
@@ -140,9 +138,7 @@ const downloadResponse = () => {
const copyResponse = () => { const copyResponse = () => {
copyToClipboard(responseBodyText.value) copyToClipboard(responseBodyText.value)
copyIcon.value = "check" copyIcon.value = "check"
$toast.success(`${t("state.copied_to_clipboard")}`, { $toast.success(`${t("state.copied_to_clipboard")}`)
icon: "content_paste",
})
setTimeout(() => (copyIcon.value = "copy"), 1000) setTimeout(() => (copyIcon.value = "copy"), 1000)
} }

View File

@@ -103,9 +103,7 @@ export default defineComponent({
document.body.appendChild(a) document.body.appendChild(a)
a.click() a.click()
this.downloadIcon = "check" this.downloadIcon = "check"
this.$toast.success(this.$t("state.download_started"), { this.$toast.success(this.$t("state.download_started"))
icon: "downloading",
})
setTimeout(() => { setTimeout(() => {
document.body.removeChild(a) document.body.removeChild(a)
URL.revokeObjectURL(url) URL.revokeObjectURL(url)

View File

@@ -234,9 +234,7 @@ const downloadResponse = () => {
document.body.appendChild(a) document.body.appendChild(a)
a.click() a.click()
downloadIcon.value = "check" downloadIcon.value = "check"
$toast.success(`${t("state.download_started")}`, { $toast.success(`${t("state.download_started")}`)
icon: "downloading",
})
setTimeout(() => { setTimeout(() => {
document.body.removeChild(a) document.body.removeChild(a)
URL.revokeObjectURL(url) URL.revokeObjectURL(url)
@@ -256,9 +254,7 @@ const outlinePath = computed(() => {
const copyResponse = () => { const copyResponse = () => {
copyToClipboard(responseBodyText.value) copyToClipboard(responseBodyText.value)
copyIcon.value = "check" copyIcon.value = "check"
$toast.success(`${t("state.copied_to_clipboard")}`, { $toast.success(`${t("state.copied_to_clipboard")}`)
icon: "content_paste",
})
setTimeout(() => (copyIcon.value = "copy"), 1000) setTimeout(() => (copyIcon.value = "copy"), 1000)
} }
</script> </script>

View File

@@ -117,9 +117,7 @@ const downloadResponse = () => {
document.body.appendChild(a) document.body.appendChild(a)
a.click() a.click()
downloadIcon.value = "check" downloadIcon.value = "check"
$toast.success(`${t("state.download_started")}`, { $toast.success(`${t("state.download_started")}`)
icon: "downloading",
})
setTimeout(() => { setTimeout(() => {
document.body.removeChild(a) document.body.removeChild(a)
URL.revokeObjectURL(url) URL.revokeObjectURL(url)
@@ -130,9 +128,7 @@ const downloadResponse = () => {
const copyResponse = () => { const copyResponse = () => {
copyToClipboard(responseBodyText.value) copyToClipboard(responseBodyText.value)
copyIcon.value = "check" copyIcon.value = "check"
$toast.success(`${t("state.copied_to_clipboard")}`, { $toast.success(`${t("state.copied_to_clipboard")}`)
icon: "content_paste",
})
setTimeout(() => (copyIcon.value = "copy"), 1000) setTimeout(() => (copyIcon.value = "copy"), 1000)
} }
</script> </script>

View File

@@ -117,9 +117,7 @@ const downloadResponse = () => {
document.body.appendChild(a) document.body.appendChild(a)
a.click() a.click()
downloadIcon.value = "check" downloadIcon.value = "check"
$toast.success(`${t("state.download_started")}`, { $toast.success(`${t("state.download_started")}`)
icon: "downloading",
})
setTimeout(() => { setTimeout(() => {
document.body.removeChild(a) document.body.removeChild(a)
URL.revokeObjectURL(url) URL.revokeObjectURL(url)
@@ -130,9 +128,7 @@ const downloadResponse = () => {
const copyResponse = () => { const copyResponse = () => {
copyToClipboard(responseBodyText.value) copyToClipboard(responseBodyText.value)
copyIcon.value = "check" copyIcon.value = "check"
$toast.success(`${t("state.copied_to_clipboard")}`, { $toast.success(`${t("state.copied_to_clipboard")}`)
icon: "content_paste",
})
setTimeout(() => (copyIcon.value = "copy"), 1000) setTimeout(() => (copyIcon.value = "copy"), 1000)
} }
</script> </script>

View File

@@ -288,9 +288,7 @@ export default defineComponent({
color: "var(--accent-color)", color: "var(--accent-color)",
ts: new Date().toLocaleTimeString(), ts: new Date().toLocaleTimeString(),
}) })
this.$toast.success(this.$t("state.connected"), { this.$toast.success(this.$t("state.connected"))
icon: "sync",
})
}, },
onMessageArrived({ payloadString, destinationName }) { onMessageArrived({ payloadString, destinationName }) {
this.log.push({ this.log.push({
@@ -321,13 +319,9 @@ export default defineComponent({
this.connectingState = false this.connectingState = false
this.connectionState = false this.connectionState = false
if (this.manualDisconnect) { if (this.manualDisconnect) {
this.$toast.error(this.$t("state.disconnected"), { this.$toast.error(this.$t("state.disconnected"))
icon: "sync_disabled",
})
} else { } else {
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
} }
this.manualDisconnect = false this.manualDisconnect = false
this.subscriptionState = false this.subscriptionState = false

View File

@@ -325,9 +325,7 @@ export default defineComponent({
ts: new Date().toLocaleTimeString(), ts: new Date().toLocaleTimeString(),
}, },
] ]
this.$toast.success(this.$t("state.connected"), { this.$toast.success(this.$t("state.connected"))
icon: "sync",
})
}) })
this.io.on("*", ({ data }) => { this.io.on("*", ({ data }) => {
const [eventName, message] = data const [eventName, message] = data
@@ -355,15 +353,11 @@ export default defineComponent({
color: "#ff5555", color: "#ff5555",
ts: new Date().toLocaleTimeString(), ts: new Date().toLocaleTimeString(),
}) })
this.$toast.error(this.$t("state.disconnected"), { this.$toast.error(this.$t("state.disconnected"))
icon: "sync_disabled",
})
}) })
} catch (e) { } catch (e) {
this.handleError(e) this.handleError(e)
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
} }
logHoppRequestRunToAnalytics({ logHoppRequestRunToAnalytics({

View File

@@ -171,9 +171,7 @@ export default defineComponent({
ts: new Date().toLocaleTimeString(), ts: new Date().toLocaleTimeString(),
}, },
] ]
this.$toast.success(this.$t("state.connected"), { this.$toast.success(this.$t("state.connected"))
icon: "sync",
})
} }
this.sse.onerror = () => { this.sse.onerror = () => {
this.handleSSEError() this.handleSSEError()
@@ -188,9 +186,7 @@ export default defineComponent({
color: "#ff5555", color: "#ff5555",
ts: new Date().toLocaleTimeString(), ts: new Date().toLocaleTimeString(),
}) })
this.$toast.error(this.$t("state.disconnected"), { this.$toast.error(this.$t("state.disconnected"))
icon: "sync_disabled",
})
} }
this.sse.addEventListener(this.eventType, ({ data }) => { this.sse.addEventListener(this.eventType, ({ data }) => {
this.events.log.push({ this.events.log.push({
@@ -201,9 +197,7 @@ export default defineComponent({
}) })
} catch (e) { } catch (e) {
this.handleSSEError(e) this.handleSSEError(e)
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
} }
} else { } else {
this.events.log = [ this.events.log = [

View File

@@ -319,9 +319,7 @@ export default defineComponent({
ts: new Date().toLocaleTimeString(), ts: new Date().toLocaleTimeString(),
}, },
] ]
this.$toast.success(this.$t("state.connected"), { this.$toast.success(this.$t("state.connected"))
icon: "sync",
})
} }
this.socket.onerror = () => { this.socket.onerror = () => {
this.handleError() this.handleError()
@@ -334,9 +332,7 @@ export default defineComponent({
color: "#ff5555", color: "#ff5555",
ts: new Date().toLocaleTimeString(), ts: new Date().toLocaleTimeString(),
}) })
this.$toast.error(this.$t("state.disconnected"), { this.$toast.error(this.$t("state.disconnected"))
icon: "sync_disabled",
})
} }
this.socket.onmessage = ({ data }) => { this.socket.onmessage = ({ data }) => {
this.communication.log.push({ this.communication.log.push({
@@ -347,9 +343,7 @@ export default defineComponent({
} }
} catch (e) { } catch (e) {
this.handleError(e) this.handleError(e)
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
} }
logHoppRequestRunToAnalytics({ logHoppRequestRunToAnalytics({
@@ -433,7 +427,6 @@ export default defineComponent({
const oldProtocols = this.protocols.slice() const oldProtocols = this.protocols.slice()
this.$delete(this.protocols, index) this.$delete(this.protocols, index)
this.$toast.success(this.$t("state.deleted"), { this.$toast.success(this.$t("state.deleted"), {
icon: "delete",
action: { action: {
text: this.$t("action.undo"), text: this.$t("action.undo"),
duration: 4000, duration: 4000,

View File

@@ -1,5 +1,5 @@
<template> <template>
<SmartModal v-if="show" :title="$t('team.new').toString()" @close="hideModal"> <SmartModal v-if="show" :title="$t('team.new')" @close="hideModal">
<template #body> <template #body>
<div class="flex flex-col px-2"> <div class="flex flex-col px-2">
<input <input
@@ -19,12 +19,9 @@
</template> </template>
<template #footer> <template #footer>
<span> <span>
<ButtonPrimary <ButtonPrimary :label="$t('action.save')" @click.native="addNewTeam" />
:label="$t('action.save').toString()"
@click.native="addNewTeam"
/>
<ButtonSecondary <ButtonSecondary
:label="$t('action.cancel').toString()" :label="$t('action.cancel')"
@click.native="hideModal" @click.native="hideModal"
/> />
</span> </span>
@@ -66,9 +63,7 @@ const addNewTeam = () =>
(err) => { (err) => {
// err is of type "invalid_name" | GQLError<Err> // err is of type "invalid_name" | GQLError<Err>
if (err === "invalid_name") { if (err === "invalid_name") {
$toast.error(t("team.name_length_insufficient").toString(), { $toast.error(`${t("team.name_length_insufficient")}`)
icon: "error_outline",
})
} else { } else {
// Handle GQL errors (use err obj) // Handle GQL errors (use err obj)
} }

View File

@@ -361,13 +361,9 @@ const removeExistingTeamMember = async (userID: string) => {
props.editingTeamID props.editingTeamID
)() )()
if (E.isLeft(removeTeamMemberResult)) { if (E.isLeft(removeTeamMemberResult)) {
$toast.error(t("error.something_went_wrong"), { $toast.error(`${t("error.something_went_wrong")}`)
icon: "error",
})
} else { } else {
$toast.success(t("team.member_removed"), { $toast.success(`${t("team.member_removed")}`)
icon: "done",
})
} }
} }
@@ -379,9 +375,7 @@ const saveTeam = async () => {
name.value name.value
)() )()
if (E.isLeft(updateTeamNameResult)) { if (E.isLeft(updateTeamNameResult)) {
$toast.error(t("error.something_went_wrong"), { $toast.error(`${t("error.something_went_wrong")}`)
icon: "error",
})
} else { } else {
roleUpdates.value.forEach(async (update) => { roleUpdates.value.forEach(async (update) => {
const updateMemberRoleResult = await updateTeamMemberRole( const updateMemberRoleResult = await updateTeamMemberRole(
@@ -390,26 +384,18 @@ const saveTeam = async () => {
update.role update.role
)() )()
if (E.isLeft(updateMemberRoleResult)) { if (E.isLeft(updateMemberRoleResult)) {
$toast.error(t("error.something_went_wrong"), { $toast.error(`${t("error.something_went_wrong")}`)
icon: "error",
})
console.error(updateMemberRoleResult.left.error) console.error(updateMemberRoleResult.left.error)
} }
}) })
} }
hideModal() hideModal()
$toast.success(t("team.saved"), { $toast.success(`${t("team.saved")}`)
icon: "done",
})
} else { } else {
return $toast.error(t("team.name_length_insufficient"), { return $toast.error(`${t("team.name_length_insufficient")}`)
icon: "error_outline",
})
} }
} else { } else {
return $toast.error(t("empty.team_name"), { return $toast.error(`${t("empty.team_name")}`)
icon: "error_outline",
})
} }
} }

View File

@@ -491,13 +491,9 @@ watch(
const removeInvitee = async (id: string) => { const removeInvitee = async (id: string) => {
const result = await revokeTeamInvitation(id)() const result = await revokeTeamInvitation(id)()
if (E.isLeft(result)) { if (E.isLeft(result)) {
$toast.error(`${t("error.something_went_wrong")}`, { $toast.error(`${t("error.something_went_wrong")}`)
icon: "error_outline",
})
} else { } else {
$toast.success(`${t("team.member_removed")}`, { $toast.success(`${t("team.member_removed")}`)
icon: "person",
})
} }
} }
@@ -557,9 +553,7 @@ const sendInvites = async () => {
if (O.isNone(validationResult)) { if (O.isNone(validationResult)) {
// Error handling for no validation // Error handling for no validation
$toast.error(`${t("error.incorrect_email")}`, { $toast.error(`${t("error.incorrect_email")}`)
icon: "error_outline",
})
return return
} }

View File

@@ -44,7 +44,7 @@
v-if="team.myRole === 'OWNER'" v-if="team.myRole === 'OWNER'"
svg="edit" svg="edit"
class="rounded-none" class="rounded-none"
:label="$t('action.edit').toString()" :label="$t('action.edit')"
@click.native=" @click.native="
() => { () => {
$emit('edit-team') $emit('edit-team')
@@ -75,7 +75,7 @@
<SmartItem <SmartItem
v-if="team.myRole === 'OWNER'" v-if="team.myRole === 'OWNER'"
svg="edit" svg="edit"
:label="$t('action.edit').toString()" :label="$t('action.edit')"
@click.native=" @click.native="
() => { () => {
$emit('edit-team') $emit('edit-team')
@@ -87,7 +87,7 @@
v-if="team.myRole === 'OWNER'" v-if="team.myRole === 'OWNER'"
svg="trash-2" svg="trash-2"
color="red" color="red"
:label="$t('action.delete').toString()" :label="$t('action.delete')"
@click.native=" @click.native="
() => { () => {
deleteTeam() deleteTeam()
@@ -98,7 +98,7 @@
<SmartItem <SmartItem
v-if="!(team.myRole === 'OWNER' && team.ownersCount == 1)" v-if="!(team.myRole === 'OWNER' && team.ownersCount == 1)"
svg="trash" svg="trash"
:label="$t('team.exit').toString()" :label="$t('team.exit')"
@click.native=" @click.native="
() => { () => {
exitTeam() exitTeam()
@@ -150,22 +150,18 @@ const {
const t = i18n.t.bind(i18n) const t = i18n.t.bind(i18n)
const deleteTeam = () => { const deleteTeam = () => {
if (!confirm(t("confirm.remove_team").toString())) return if (!confirm(`${t("confirm.remove_team")}`)) return
pipe( pipe(
backendDeleteTeam(props.teamID), backendDeleteTeam(props.teamID),
TE.match( TE.match(
(err) => { (err) => {
// TODO: Better errors ? We know the possible errors now // TODO: Better errors ? We know the possible errors now
$toast.error(t("error.something_went_wrong").toString(), { $toast.error(`${t("error.something_went_wrong")}`)
icon: "error_outline",
})
console.error(err) console.error(err)
}, },
() => { () => {
$toast.success(t("team.deleted").toString(), { $toast.success(`${t("team.deleted")}`)
icon: "done",
})
} }
) )
)() // Tasks (and TEs) are lazy, so call the function returned )() // Tasks (and TEs) are lazy, so call the function returned
@@ -179,23 +175,17 @@ const exitTeam = () => {
TE.match( TE.match(
(err) => { (err) => {
// TODO: Better errors ? // TODO: Better errors ?
$toast.error(t("error.something_went_wrong").toString(), { $toast.error(`${t("error.something_went_wrong")}`)
icon: "error_outline",
})
console.error(err) console.error(err)
}, },
() => { () => {
$toast.success(t("team.left").toString(), { $toast.success(`${t("team.left")}`)
icon: "done",
})
} }
) )
)() // Tasks (and TEs) are lazy, so call the function returned )() // Tasks (and TEs) are lazy, so call the function returned
} }
const noPermission = () => { const noPermission = () => {
$toast.error(t("profile.no_permission").toString(), { $toast.error(`${t("profile.no_permission")}`)
icon: "error_outline",
})
} }
</script> </script>

View File

@@ -171,7 +171,6 @@ export default defineComponent({
workbox.addEventListener("installed", (event: any) => { workbox.addEventListener("installed", (event: any) => {
if (event.isUpdate) { if (event.isUpdate) {
this.$toast.show(`${this.$t("app.new_version_found")}`, { this.$toast.show(`${this.$t("app.new_version_found")}`, {
icon: "download_for_offline",
duration: 0, duration: 0,
action: [ action: [
{ {

View File

@@ -230,15 +230,11 @@ export default defineComponent({
} }
) )
.then((res) => { .then((res) => {
this.$toast.success(this.$t("export.gist_created"), { this.$toast.success(this.$t("export.gist_created"))
icon: "done",
})
window.open(res.html_url) window.open(res.html_url)
}) })
.catch((e) => { .catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
console.error(e) console.error(e)
}) })
}, },
@@ -251,13 +247,9 @@ export default defineComponent({
this.collectionJSON = target.result this.collectionJSON = target.result
} }
reader.readAsText(file) reader.readAsText(file)
this.$toast.success(this.$t("state.file_imported"), { this.$toast.success(this.$t("state.file_imported"))
icon: "attach_file",
})
} else { } else {
this.$toast.error(this.$t("action.choose_file"), { this.$toast.error(this.$t("action.choose_file"))
icon: "attach_file",
})
} }
this.$refs.collectionUpload.value = "" this.$refs.collectionUpload.value = ""
}, },
@@ -288,9 +280,7 @@ export default defineComponent({
this.items = JSON.parse(this.collectionJSON) this.items = JSON.parse(this.collectionJSON)
this.assignIDs(this.items, "", "#") this.assignIDs(this.items, "", "#")
this.$toast.clear() this.$toast.clear()
this.$toast.success(this.$t("state.docs_generated"), { this.$toast.success(this.$t("state.docs_generated"))
icon: "book",
})
const docsMarkdown = Mustache.render( const docsMarkdown = Mustache.render(
DocsTemplate, DocsTemplate,
{ {
@@ -325,9 +315,7 @@ export default defineComponent({
this.docsMarkdown = docsMarkdown.replace(/^\s*[\r\n]/gm, "\n\n") this.docsMarkdown = docsMarkdown.replace(/^\s*[\r\n]/gm, "\n\n")
} catch (e) { } catch (e) {
console.error(e) console.error(e)
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(this.$t("error.something_went_wrong"))
icon: "error_outline",
})
} }
}, },

View File

@@ -238,9 +238,7 @@ export default defineComponent({
TE.matchW( TE.matchW(
() => { () => {
this.loading = false this.loading = false
this.$toast.error(this.$t("error.something_went_wrong"), { this.$toast.error(`${this.$t("error.something_went_wrong")}`)
icon: "error_outline",
})
}, },
() => { () => {
this.joinTeamSuccess = true this.joinTeamSuccess = true

View File

@@ -99,7 +99,7 @@
required required
/> />
<ButtonPrimary <ButtonPrimary
:label="$t('action.save').toString()" :label="$t('action.save')"
class="ml-2 min-w-16" class="ml-2 min-w-16"
type="submit" type="submit"
:loading="updatingDisplayName" :loading="updatingDisplayName"

View File

@@ -328,9 +328,7 @@ export default defineComponent({
resetProxy() { resetProxy() {
applySetting("PROXY_URL", `https://proxy.hoppscotch.io/`) applySetting("PROXY_URL", `https://proxy.hoppscotch.io/`)
this.clearIcon = "check" this.clearIcon = "check"
this.$toast.success(`${this.$t("state.cleared")}`, { this.$toast.success(`${this.$t("state.cleared")}`)
icon: "clear_all",
})
setTimeout(() => (this.clearIcon = "rotate-ccw"), 1000) setTimeout(() => (this.clearIcon = "rotate-ccw"), 1000)
}, },
getColorModeName(colorMode: string) { getColorModeName(colorMode: string) {