5555 </v-btn >
5656 </v-list-item >
5757 <ConfirmModal ref =" confirmModal" />
58+ <v-snackbar
59+ v-model =" snackbar.show"
60+ :timeout =" snackbar.timeout"
61+ :color =" snackbar.color"
62+ >
63+ {{ snackbar.text }}
64+ </v-snackbar >
5865</template >
5966
6067<script setup>
61- import { ref } from " vue" ;
68+ import { ref , reactive } from " vue" ;
6269import { useStore } from " vuex" ;
6370import i18n from " @/i18n" ;
6471const electron = window .require (" electron" );
@@ -71,7 +78,12 @@ const confirmModal = ref();
7178const store = useStore ();
7279const jsonData = ref (null );
7380const MongoDB_URL = ref (store .state .MongoDB_URL );
74-
81+ const snackbar = reactive ({
82+ show: false ,
83+ text: " " ,
84+ timeout: 1500 ,
85+ color: " success" ,
86+ });
7587const setMongoDBURL = (url ) => {
7688 store .commit (" setMongoDBURL" , url);
7789};
@@ -82,10 +94,18 @@ async function upload() {
8294 );
8395 if (result) {
8496 const data = JSON .parse (JSON .stringify (localStorage, null , 2 ));
85- await ipcRenderer .invoke (" upload" , {
97+ // don't know why there's _id prop in localStorage that would lead to duplicate key error
98+ delete data ._id ;
99+ const is_success = await ipcRenderer .invoke (" upload" , {
86100 MongoDB_URL: MongoDB_URL .value ,
87101 data,
88102 });
103+ if (is_success) {
104+ snackbar .text = i18n .global .t (" proxy.saveSuccess" );
105+ snackbar .color = " success" ;
106+ snackbar .timeout = 1000 ;
107+ snackbar .show = true ;
108+ }
89109 }
90110}
91111async function download () {
0 commit comments