File tree Expand file tree Collapse file tree 1 file changed +20
-8
lines changed
@uportal/notification-list/src/components Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -70,14 +70,26 @@ export default {
7070 }
7171 },
7272 methods: {
73- gotoAction (action ) {
74- const form = document .createElement (' form' );
75- form .action = action .apiUrl ;
76- form .method = ' POST' ;
77- form .target = ' _blank' ;
78- form .style .display = ' none' ;
79- document .body .appendChild (form);
80- form .submit ();
73+ async gotoAction (action ) {
74+ if (action .redirect ) {
75+ const form = document .createElement (' form' );
76+ form .action = action .apiUrl ;
77+ form .method = ' POST' ;
78+ form .target = ' _blank' ;
79+ form .style .display = ' none' ;
80+ document .body .appendChild (form);
81+ form .submit ();
82+ }
83+ else {
84+ const response = await fetch (action .apiUrl , {
85+ credentials: ' same-origin' ,
86+ method: ' POST' ,
87+ });
88+
89+ if (! response .ok || response .status !== 200 ) {
90+ throw new Error (response .statusText );
91+ }
92+ }
8193 },
8294 markAllAsRead () {
8395 this .gotoAction (this .markAllAsReadLink );
You can’t perform that action at this time.
0 commit comments