refactor: better toast messages + minor ui improvements
This commit is contained in:
@@ -38,7 +38,9 @@ export default {
|
||||
methods: {
|
||||
addNewCollection() {
|
||||
if (!this.name) {
|
||||
this.$toast.info(this.$t("collection.invalid_name"))
|
||||
this.$toast.info(this.$t("collection.invalid_name"), {
|
||||
icon: "info",
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$emit("submit", this.name)
|
||||
|
||||
@@ -45,7 +45,9 @@ export default {
|
||||
methods: {
|
||||
addFolder() {
|
||||
if (!this.name) {
|
||||
this.$toast.info(this.$t("collection.invalid_name"))
|
||||
this.$toast.info(this.$t("collection.invalid_name"), {
|
||||
icon: "info",
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$emit("add-folder", {
|
||||
|
||||
@@ -39,7 +39,9 @@ export default {
|
||||
methods: {
|
||||
saveCollection() {
|
||||
if (!this.name) {
|
||||
this.$toast.info(this.$t("collection.invalid_name"))
|
||||
this.$toast.info(this.$t("collection.invalid_name"), {
|
||||
icon: "info",
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$emit("submit", this.name)
|
||||
|
||||
@@ -42,7 +42,9 @@ export default {
|
||||
methods: {
|
||||
editFolder() {
|
||||
if (!this.name) {
|
||||
this.$toast.info(this.$t("collection.invalid_name"))
|
||||
this.$toast.info(this.$t("collection.invalid_name"), {
|
||||
icon: "info",
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$emit("submit", this.name)
|
||||
|
||||
@@ -41,7 +41,9 @@ export default {
|
||||
methods: {
|
||||
saveRequest() {
|
||||
if (!this.requestUpdateData.name) {
|
||||
this.$toast.info(this.$t("collection.invalid_name"))
|
||||
this.$toast.info(this.$t("collection.invalid_name"), {
|
||||
icon: "info",
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$emit("submit", this.requestUpdateData)
|
||||
|
||||
@@ -219,11 +219,11 @@ export default {
|
||||
})
|
||||
window.open(res.html_url)
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$toast.error(this.$t("something_went_wrong"), {
|
||||
.catch((e) => {
|
||||
this.$toast.error(this.$t("error.something_went_wrong"), {
|
||||
icon: "error",
|
||||
})
|
||||
console.log(error)
|
||||
console.error(e)
|
||||
})
|
||||
},
|
||||
async readCollectionGist() {
|
||||
@@ -240,9 +240,9 @@ export default {
|
||||
setRESTCollections(collections)
|
||||
this.fileImported()
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((e) => {
|
||||
this.failedImport()
|
||||
console.log(error)
|
||||
console.error(e)
|
||||
})
|
||||
},
|
||||
hideModal() {
|
||||
@@ -292,8 +292,8 @@ export default {
|
||||
this.failedImport()
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
.catch((e) => {
|
||||
console.error(e)
|
||||
this.failedImport()
|
||||
})
|
||||
} else {
|
||||
@@ -346,8 +346,8 @@ export default {
|
||||
this.failedImport()
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
.catch((e) => {
|
||||
console.error(e)
|
||||
this.failedImport()
|
||||
})
|
||||
} else {
|
||||
@@ -373,8 +373,8 @@ export default {
|
||||
this.failedImport()
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
.catch((e) => {
|
||||
console.error(e)
|
||||
this.failedImport()
|
||||
})
|
||||
},
|
||||
@@ -409,7 +409,7 @@ export default {
|
||||
}, 1000)
|
||||
},
|
||||
fileImported() {
|
||||
this.$toast.info(this.$t("file_imported"), {
|
||||
this.$toast.success(this.$t("file_imported"), {
|
||||
icon: "folder_shared",
|
||||
})
|
||||
},
|
||||
|
||||
@@ -41,7 +41,9 @@ export default Vue.extend({
|
||||
methods: {
|
||||
addNewCollection() {
|
||||
if (!this.name) {
|
||||
this.$toast.info(this.$t("collection.invalid_name").toString())
|
||||
this.$toast.info(this.$t("collection.invalid_name").toString(), {
|
||||
icon: "info",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,9 @@ export default Vue.extend({
|
||||
methods: {
|
||||
saveCollection() {
|
||||
if (!this.name) {
|
||||
this.$toast.info(this.$t("collection.invalid_name").toString())
|
||||
this.$toast.info(this.$t("collection.invalid_name").toString(), {
|
||||
icon: "info",
|
||||
})
|
||||
return
|
||||
}
|
||||
const collectionUpdated = {
|
||||
|
||||
@@ -47,7 +47,9 @@ export default Vue.extend({
|
||||
methods: {
|
||||
editFolder() {
|
||||
if (!this.name) {
|
||||
this.$toast.info(this.$t("collection.invalid_name").toString())
|
||||
this.$toast.info(this.$t("collection.invalid_name").toString(), {
|
||||
icon: "info",
|
||||
})
|
||||
return
|
||||
}
|
||||
editGraphqlFolder(this.folderPath, { ...this.folder, name: this.name })
|
||||
|
||||
@@ -46,7 +46,9 @@ export default Vue.extend({
|
||||
methods: {
|
||||
saveRequest() {
|
||||
if (!this.requestUpdateData.name) {
|
||||
this.$toast.info(this.$t("collection.invalid_name").toString())
|
||||
this.$toast.info(this.$t("collection.invalid_name").toString(), {
|
||||
icon: "info",
|
||||
})
|
||||
return
|
||||
}
|
||||
const requestUpdated = {
|
||||
|
||||
@@ -138,11 +138,11 @@ export default {
|
||||
})
|
||||
window.open(res.html_url)
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$toast.error(this.$t("something_went_wrong"), {
|
||||
.catch((e) => {
|
||||
this.$toast.error(this.$t("error.something_went_wrong"), {
|
||||
icon: "error",
|
||||
})
|
||||
console.log(error)
|
||||
console.error(e)
|
||||
})
|
||||
},
|
||||
async readCollectionGist() {
|
||||
@@ -159,9 +159,9 @@ export default {
|
||||
setGraphqlCollections(collections)
|
||||
this.fileImported()
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((e) => {
|
||||
this.failedImport()
|
||||
console.log(error)
|
||||
console.error(e)
|
||||
})
|
||||
},
|
||||
hideModal() {
|
||||
|
||||
@@ -133,12 +133,7 @@ export default Vue.extend({
|
||||
selectRequest() {
|
||||
if (this.savingMode) {
|
||||
this.pick()
|
||||
return
|
||||
}
|
||||
|
||||
this.$store.commit("postwoman/selectGraphqlRequest", {
|
||||
request: this.request,
|
||||
})
|
||||
},
|
||||
dragStart({ dataTransfer }: any) {
|
||||
this.dragging = !this.dragging
|
||||
|
||||
@@ -333,11 +333,11 @@ export default {
|
||||
icon: "done",
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$toast.error(this.$t("error_occurred"), {
|
||||
icon: "done",
|
||||
.catch((e) => {
|
||||
this.$toast.error(this.$t("error.something_went_wrong"), {
|
||||
icon: "error",
|
||||
})
|
||||
console.error(error)
|
||||
console.error(e)
|
||||
})
|
||||
}
|
||||
this.displayModalAdd(false)
|
||||
@@ -345,7 +345,9 @@ export default {
|
||||
// Intented to be called by CollectionEdit modal submit event
|
||||
updateEditingCollection(newName) {
|
||||
if (!newName) {
|
||||
this.$toast.info(this.$t("collection.invalid_name"))
|
||||
this.$toast.info(this.$t("collection.invalid_name"), {
|
||||
icon: "info",
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.collectionsType.type === "my-collections") {
|
||||
@@ -367,11 +369,11 @@ export default {
|
||||
icon: "done",
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$toast.error(this.$t("error_occurred"), {
|
||||
icon: "done",
|
||||
.catch((e) => {
|
||||
this.$toast.error(this.$t("error.something_went_wrong"), {
|
||||
icon: "error",
|
||||
})
|
||||
console.error(error)
|
||||
console.error(e)
|
||||
})
|
||||
}
|
||||
this.displayModalEdit(false)
|
||||
@@ -387,17 +389,15 @@ export default {
|
||||
teamUtils
|
||||
.renameCollection(this.$apollo, name, this.editingFolder.id)
|
||||
.then(() => {
|
||||
// Result
|
||||
this.$toast.success(this.$t("folder.renamed"), {
|
||||
icon: "done",
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
// Error
|
||||
this.$toast.error(this.$t("error_occurred"), {
|
||||
icon: "done",
|
||||
.catch((e) => {
|
||||
this.$toast.error(this.$t("error.something_went_wrong"), {
|
||||
icon: "error",
|
||||
})
|
||||
console.error(error)
|
||||
console.error(e)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -434,11 +434,11 @@ export default {
|
||||
})
|
||||
this.$emit("update-team-collections")
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$toast.error(this.$t("error_occurred"), {
|
||||
icon: "done",
|
||||
.catch((e) => {
|
||||
this.$toast.error(this.$t("error.something_went_wrong"), {
|
||||
icon: "error",
|
||||
})
|
||||
console.error(error)
|
||||
console.error(e)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -502,18 +502,16 @@ export default {
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
// Result
|
||||
this.$toast.success(this.$t("folder.created"), {
|
||||
icon: "done",
|
||||
})
|
||||
this.$emit("update-team-collections")
|
||||
})
|
||||
.catch((error) => {
|
||||
// Error
|
||||
this.$toast.error(this.$t("error_occurred"), {
|
||||
icon: "done",
|
||||
.catch((e) => {
|
||||
this.$toast.error(this.$t("error.something_went_wrong"), {
|
||||
icon: "error",
|
||||
})
|
||||
console.error(error)
|
||||
console.error(e)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -605,17 +603,15 @@ export default {
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
// Result
|
||||
this.$toast.success(this.$t("deleted"), {
|
||||
this.$toast.error(this.$t("deleted"), {
|
||||
icon: "delete",
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
// Error
|
||||
this.$toast.error(this.$t("error_occurred"), {
|
||||
icon: "done",
|
||||
.catch((e) => {
|
||||
this.$toast.error(this.$t("error.something_went_wrong"), {
|
||||
icon: "error",
|
||||
})
|
||||
console.error(error)
|
||||
console.error(e)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -649,17 +645,15 @@ export default {
|
||||
teamUtils
|
||||
.deleteRequest(this.$apollo, requestIndex)
|
||||
.then(() => {
|
||||
// Result
|
||||
this.$toast.success(this.$t("deleted"), {
|
||||
this.$toast.error(this.$t("deleted"), {
|
||||
icon: "delete",
|
||||
})
|
||||
})
|
||||
.catch((error) => {
|
||||
// Error
|
||||
this.$toast.error(this.$t("error_occurred"), {
|
||||
icon: "done",
|
||||
.catch((e) => {
|
||||
this.$toast.error(this.$t("error.something_went_wrong"), {
|
||||
icon: "error",
|
||||
})
|
||||
console.error(error)
|
||||
console.error(e)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
v-tippy="{ theme: 'tooltip' }"
|
||||
icon="create_new_folder"
|
||||
:title="$t('folder.new')"
|
||||
class="group-hover:inline-flex hidden"
|
||||
class="hidden group-hover:inline-flex"
|
||||
@click.native="$emit('add-folder', { folder, path: folderPath })"
|
||||
/>
|
||||
<tippy
|
||||
@@ -219,18 +219,16 @@ export default {
|
||||
teamUtils
|
||||
.deleteCollection(this.$apollo, this.folder.id)
|
||||
.then(() => {
|
||||
// Result
|
||||
this.$toast.success(this.$t("deleted"), {
|
||||
this.$toast.error(this.$t("deleted"), {
|
||||
icon: "delete",
|
||||
})
|
||||
this.$emit("update-team-collections")
|
||||
})
|
||||
.catch((error) => {
|
||||
// Error
|
||||
this.$toast.error(this.$t("error_occurred"), {
|
||||
icon: "done",
|
||||
.catch((e) => {
|
||||
this.$toast.error(this.$t("error.something_went_wrong"), {
|
||||
icon: "error",
|
||||
})
|
||||
console.error(error)
|
||||
console.error(e)
|
||||
})
|
||||
this.$emit("update-team-collections")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user