Skip to content

Commit

Permalink
Simplify showing and hiding snackbar message
Browse files Browse the repository at this point in the history
  • Loading branch information
srimanachanta committed Jul 27, 2023
1 parent 133d74b commit 3118d5e
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions photon-client/src/stores/StateStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,16 @@ export const useStateStore = defineStore("state", {
};
},
showSnackbarMessage(data: {
show?: boolean,
message: string,
color: string,
timeout?: number
}) {
this.snackbarData = {
show: data.show || true,
show: true,
message: data.message,
color: data.color,
timeout: data.timeout || 2000
};

if(data.timeout != -1) {
setTimeout(this.hideSnackbarMessage, data.timeout || 2000);
}
},
hideSnackbarMessage() {
this.snackbarData = { show: false, timeout: 0, color: "error", message: "" };
}
}
});

0 comments on commit 3118d5e

Please sign in to comment.