diff --git a/README.md b/README.md index b417eb988..10dfecc57 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ docker run -p 3000:3000 postwoman:latest 1. Find the built project in `./dist`. -## Contributing ⚗ +## Contributing 🍰 Please read [CONTRIBUTING](CONTRIBUTING.md) for details on our [CODE OF CONDUCT](CODE_OF_CONDUCT.md), and the process for submitting pull requests to us. diff --git a/components/logo.vue b/components/logo.vue index d3af5f4a7..3e080efe6 100644 --- a/components/logo.vue +++ b/components/logo.vue @@ -1,29 +1,32 @@ \ No newline at end of file + } + diff --git a/pages/index.vue b/pages/index.vue index 9cffc577a..56a4439fe 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -694,7 +694,11 @@ }, async sendRequest() { if (!this.isValidURL) { - alert('Please check the formatting of the URL.'); + this.$toast.error('URL is not formatted properly', { + icon: 'error', + position: 'bottom-center', + duration: 1000, + }); return; } @@ -808,7 +812,7 @@ this.response.status = error.message; this.response.body = "See JavaScript console (F12) for details."; this.$toast.error('Something went wrong!', { - icon: 'delete', + icon: 'error', position: 'bottom-center', duration: 1000, }); @@ -907,28 +911,47 @@ text: `Postwoman • API request builder at ${time} on ${date}`, url: window.location.href }).then(() => { - // console.log('Thanks for sharing!'); + this.$toast.success('Thanks for sharing!', { + icon: 'share', + position: 'bottom-center', + duration: 1000, + }); }) .catch(console.error); } else { this.$refs.copyRequest.innerHTML = this.copiedButton + 'Copied'; + this.$toast.success('Copied to clipboard', { + icon: 'file_copy', + position: 'bottom-center', + duration: 1000, + }); var dummy = document.createElement('input'); document.body.appendChild(dummy); dummy.value = window.location.href; dummy.select(); document.execCommand('copy'); document.body.removeChild(dummy); - setTimeout(() => this.$refs.copyRequest.innerHTML = this.copyButton + 'Permalink', 1500) + setTimeout(() => this.$refs.copyRequest.innerHTML = this.copyButton + 'Permalink', 1000) } }, copyRequestCode() { this.$refs.copyRequestCode.innerHTML = this.copiedButton + 'Copied'; + this.$toast.success('Copied to clipboard', { + icon: 'file_copy', + position: 'bottom-center', + duration: 1000, + }); this.$refs.generatedCode.select(); document.execCommand("copy"); - setTimeout(() => this.$refs.copyRequestCode.innerHTML = this.copyButton + 'Copy', 1500) + setTimeout(() => this.$refs.copyRequestCode.innerHTML = this.copyButton + 'Copy', 1000) }, copyResponse() { this.$refs.copyResponse.innerHTML = this.copiedButton + 'Copied'; + this.$toast.success('Copied to clipboard', { + icon: 'file_copy', + position: 'bottom-center', + duration: 1000, + }); // Creates a textarea element var aux = document.createElement("textarea"); var copy = this.responseType == 'application/json' ? JSON.stringify(this.response.body) : this.response.body; @@ -941,7 +964,7 @@ document.execCommand('copy'); // Remove the input from the body document.body.removeChild(aux); - setTimeout(() => this.$refs.copyResponse.innerHTML = this.copyButton + 'Copy', 1500) + setTimeout(() => this.$refs.copyResponse.innerHTML = this.copyButton + 'Copy', 1000) }, togglePreview() { this.previewEnabled = !this.previewEnabled; @@ -1023,6 +1046,11 @@ this.showModal = false; } catch (error) { this.showModal = false; + this.$toast.error('cURL is not formatted properly', { + icon: 'error', + position: 'bottom-center', + duration: 1000, + }); } }, toggleModal() { diff --git a/pages/websocket.vue b/pages/websocket.vue index 4dbe5a805..4e9c5e404 100644 --- a/pages/websocket.vue +++ b/pages/websocket.vue @@ -130,6 +130,11 @@ color: 'var(--ac-color)', ts: (new Date()).toLocaleTimeString() }]; + this.$toast.success('Connected', { + icon: 'sync', + position: 'bottom-center', + duration: 1000, + }); }; this.socket.onerror = (event) => { this.handleError(); @@ -142,6 +147,11 @@ color: '#ff5555', ts: (new Date()).toLocaleTimeString() }); + this.$toast.error('Disconnected', { + icon: 'sync_disabled', + position: 'bottom-center', + duration: 1000, + }); }; this.socket.onmessage = (event) => { this.communication.log.push({ @@ -152,6 +162,11 @@ } } catch (ex) { this.handleError(ex); + this.$toast.error('Something went wrong!', { + icon: 'error', + position: 'bottom-center', + duration: 1000, + }); } }, disconnect() {