File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ import PieGraph from "@/views/components/PieGraph.vue"
16
16
import LineGraph from " @/views/components/LineGraph.vue" ;
17
17
import GaugeGraph from " @/views/components/GaugeGraph.vue" ;
18
18
import store from " @/store" ;
19
- import { useToast } from ' vue-toastification' ; // vue-toastification 라이브러리에서 useToast 함수를 가져옵니다.
19
+ import { useToast } from ' vue-toastification' ;
20
+ import {defaultInstance } from " @/axios/axios-instance" ; // vue-toastification 라이브러리에서 useToast 함수를 가져옵니다.
20
21
21
22
export default {
22
23
components: {
@@ -30,7 +31,12 @@ export default {
30
31
return store .getters .projectId ;
31
32
}
32
33
},
33
- mounted () {
34
+ async mounted () {
35
+ try {
36
+ defaultInstance .get (` /graphs/refresh` ); // 프로젝트 ID를 이용해 프로젝트 정보를 가져옵니다.
37
+ } catch (error) {
38
+ toast .error (" 데이터를 불러오는 중 오류가 발생했습니다." ); // 데이터를 불러오는 중 오류가 발생한 경우 토스트 메시지를 표시합니다.
39
+ }
34
40
const toast = useToast (); // 토스트 메시지를 사용할 수 있는 toast 객체를 생성합니다.
35
41
if (! this .projectId ) {
36
42
toast .warning (" 표시할 데이터가 없습니다." ); // projectId가 없는 경우 토스트 메시지를 표시합니다.
Original file line number Diff line number Diff line change 12
12
<i class =" material-icons text-white me-2" >notifications</i >
13
13
<h6 class =" text-white text-capitalize mb-0" >알림</h6 >
14
14
</div >
15
+ <div class =" d-flex align-items-center" >
16
+ <button
17
+ class =" btn btn-link text-white text-decoration-none"
18
+ @click =" sendNotifications"
19
+ >
20
+ <i class =" material-icons text-white" >refresh</i > 새로고침
21
+ </button >
22
+ </div >
15
23
</div >
16
24
</div >
17
25
<!-- 카드 본문 -->
@@ -156,6 +164,15 @@ const fetchNotifications = async () => {
156
164
// stopPolling: null,
157
165
// });
158
166
167
+ // 알림 생성 메소드 (임시)
168
+ const sendNotifications = async () => {
169
+ try {
170
+ await defaultInstance .get (` /notifications/send/${ store .getters .projectId } ` );
171
+ } catch (error) {
172
+ toast .error (` 알림을 보내는 중 오류 발생: ${ error .message } ` );
173
+ }
174
+ };
175
+
159
176
onMounted (async () => {
160
177
store .dispatch (" notifications/resetNotification" );
161
178
await fetchNotifications ();
You can’t perform that action at this time.
0 commit comments