浏览代码

chore: moved SaveButton.vue to the main mixins folder

Signed-off-by: Jonathan <theflametrooper@gmail.com>
Jonathan 4 年之前
父节点
当前提交
865d3055c4

+ 1 - 1
frontend/src/components/modals/EditStation.vue

@@ -753,7 +753,7 @@ export default {
 					if (this.originalStation)
 						this.originalStation.locked = res.data;
 					return new Toast({
-						content: `Toggled queue lock succesfully to ${res.data}`,
+						content: `Toggled queue lock successfully to ${res.data}`,
 						timeout: 4000
 					});
 				}

+ 2 - 2
frontend/src/pages/Settings/mixins/SaveButton.vue → frontend/src/mixins/SaveButton.vue

@@ -30,7 +30,7 @@ export default {
 		}
 	},
 	methods: {
-		successfulSave() {
+		handleSuccessfulSave() {
 			if (this.saveStatus !== "save-success") {
 				this.saveStatus = "save-success";
 				setTimeout(() => {
@@ -38,7 +38,7 @@ export default {
 				}, 2000);
 			}
 		},
-		failedSave() {
+		handleFailedSave() {
 			if (this.saveStatus !== "save-failure") {
 				this.saveStatus = "save-failure";
 				setTimeout(() => {

+ 6 - 6
frontend/src/pages/Settings/tabs/Account.vue

@@ -72,7 +72,7 @@ import validation from "../../../validation";
 import io from "../../../io";
 
 import InputHelpBox from "../../../components/ui/InputHelpBox.vue";
-import SaveButton from "../mixins/SaveButton.vue";
+import SaveButton from "../../../mixins/SaveButton.vue";
 
 export default {
 	components: { InputHelpBox },
@@ -158,7 +158,7 @@ export default {
 			if (emailAddressChanged) this.changeEmail();
 
 			if (!usernameChanged && !emailAddressChanged) {
-				this.failedSave();
+				this.handleFailedSave();
 
 				new Toast({
 					content: "Please make a change before saving.",
@@ -191,7 +191,7 @@ export default {
 				res => {
 					if (res.status !== "success") {
 						new Toast({ content: res.message, timeout: 8000 });
-						this.failedSave();
+						this.handleFailedSave();
 					} else {
 						new Toast({
 							content: "Successfully changed email address",
@@ -203,7 +203,7 @@ export default {
 							value: email
 						});
 
-						this.successfulSave();
+						this.handleSuccessfulSave();
 					}
 				}
 			);
@@ -233,7 +233,7 @@ export default {
 				res => {
 					if (res.status !== "success") {
 						new Toast({ content: res.message, timeout: 8000 });
-						this.failedSave();
+						this.handleFailedSave();
 					} else {
 						new Toast({
 							content: "Successfully changed username",
@@ -245,7 +245,7 @@ export default {
 							value: username
 						});
 
-						this.successfulSave();
+						this.handleSuccessfulSave();
 					}
 				}
 			);

+ 4 - 4
frontend/src/pages/Settings/tabs/Preferences.vue

@@ -44,7 +44,7 @@ import { mapState, mapActions } from "vuex";
 import Toast from "toasters";
 
 import io from "../../../io";
-import SaveButton from "../mixins/SaveButton.vue";
+import SaveButton from "../../../mixins/SaveButton.vue";
 
 export default {
 	mixins: [SaveButton],
@@ -86,7 +86,7 @@ export default {
 					timeout: 5000
 				});
 
-				return this.failedSave();
+				return this.handleFailedSave();
 			}
 
 			this.saveStatus = "disabled";
@@ -101,7 +101,7 @@ export default {
 					if (res.status !== "success") {
 						new Toast({ content: res.message, timeout: 8000 });
 
-						return this.failedSave();
+						return this.handleFailedSave();
 					}
 
 					new Toast({
@@ -109,7 +109,7 @@ export default {
 						timeout: 4000
 					});
 
-					return this.successfulSave();
+					return this.handleSuccessfulSave();
 				}
 			);
 		},

+ 10 - 10
frontend/src/pages/Settings/tabs/Profile.vue

@@ -88,7 +88,7 @@ import validation from "../../../validation";
 import io from "../../../io";
 
 import ProfilePicture from "../../../components/ui/ProfilePicture.vue";
-import SaveButton from "../mixins/SaveButton.vue";
+import SaveButton from "../../../mixins/SaveButton.vue";
 
 export default {
 	components: { ProfilePicture },
@@ -139,7 +139,7 @@ export default {
 				!locationChanged &&
 				!nameChanged
 			) {
-				this.failedSave();
+				this.handleFailedSave();
 
 				new Toast({
 					content: "Please make a change before saving.",
@@ -165,7 +165,7 @@ export default {
 				res => {
 					if (res.status !== "success") {
 						new Toast({ content: res.message, timeout: 8000 });
-						this.failedSave();
+						this.handleFailedSave();
 					} else {
 						new Toast({
 							content: "Successfully changed name",
@@ -177,7 +177,7 @@ export default {
 							value: name
 						});
 
-						this.successfulSave();
+						this.handleSuccessfulSave();
 					}
 				}
 			);
@@ -200,7 +200,7 @@ export default {
 				res => {
 					if (res.status !== "success") {
 						new Toast({ content: res.message, timeout: 8000 });
-						this.failedSave();
+						this.handleFailedSave();
 					} else {
 						new Toast({
 							content: "Successfully changed location",
@@ -212,7 +212,7 @@ export default {
 							value: location
 						});
 
-						this.successfulSave();
+						this.handleSuccessfulSave();
 					}
 				}
 			);
@@ -235,7 +235,7 @@ export default {
 				res => {
 					if (res.status !== "success") {
 						new Toast({ content: res.message, timeout: 8000 });
-						this.failedSave();
+						this.handleFailedSave();
 					} else {
 						new Toast({
 							content: "Successfully changed bio",
@@ -247,7 +247,7 @@ export default {
 							value: bio
 						});
 
-						this.successfulSave();
+						this.handleSuccessfulSave();
 					}
 				}
 			);
@@ -264,7 +264,7 @@ export default {
 				res => {
 					if (res.status !== "success") {
 						new Toast({ content: res.message, timeout: 8000 });
-						this.failedSave();
+						this.handleFailedSave();
 					} else {
 						new Toast({
 							content: "Successfully updated avatar type",
@@ -276,7 +276,7 @@ export default {
 							value: avatar
 						});
 
-						this.successfulSave();
+						this.handleSuccessfulSave();
 					}
 				}
 			);