@blocklet/discuss-kit 1.5.75 → 1.5.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -106,11 +106,16 @@ const commentAPI = {
106
106
  return data;
107
107
  },
108
108
  updateComment: async ({
109
- id
109
+ id,
110
+ updatedAt
110
111
  }, content) => {
111
- await api__default.default.put(`/comments/${id}`, {
112
- content
112
+ const {
113
+ data
114
+ } = await api__default.default.put(`/comments/${id}`, {
115
+ content,
116
+ updatedAt
113
117
  });
118
+ return formatComment(data);
114
119
  },
115
120
  reply: async ({
116
121
  id,
@@ -149,6 +154,9 @@ function DiscussKitComments({
149
154
  commentInputPosition,
150
155
  showTopbar
151
156
  }) {
157
+ discussKitUx.useDefaultApiErrorHandler({
158
+ request: api__default.default
159
+ });
152
160
  const {
153
161
  session
154
162
  } = react.useContext(Session.SessionContext) || {};
@@ -10,7 +10,7 @@ import CircularProgress from "@mui/material/CircularProgress";
10
10
  import ButtonGroup from "@mui/material/ButtonGroup";
11
11
  import { useLocaleContext, LocaleProvider } from "@arcblock/ux/lib/Locale/context";
12
12
  import { ErrorBoundary } from "react-error-boundary";
13
- import { InternalThemeProvider, DefaultEditorConfigProvider, CommentsProvider, useCommentsContext, GithubReaction, CommentInput, CommentList } from "@blocklet/discuss-kit-ux";
13
+ import { InternalThemeProvider, DefaultEditorConfigProvider, CommentsProvider, useDefaultApiErrorHandler, useCommentsContext, GithubReaction, CommentInput, CommentList } from "@blocklet/discuss-kit-ux";
14
14
  import { useRequest } from "ahooks";
15
15
  import ErrorFallback from "./components/error-fallback";
16
16
  import { translations } from "./locales";
@@ -94,11 +94,16 @@ const commentAPI = {
94
94
  return data;
95
95
  },
96
96
  updateComment: async ({
97
- id
97
+ id,
98
+ updatedAt
98
99
  }, content) => {
99
- await api.put(`/comments/${id}`, {
100
- content
100
+ const {
101
+ data
102
+ } = await api.put(`/comments/${id}`, {
103
+ content,
104
+ updatedAt
101
105
  });
106
+ return formatComment(data);
102
107
  },
103
108
  reply: async ({
104
109
  id,
@@ -137,6 +142,9 @@ function DiscussKitComments({
137
142
  commentInputPosition,
138
143
  showTopbar
139
144
  }) {
145
+ useDefaultApiErrorHandler({
146
+ request: api
147
+ });
140
148
  const {
141
149
  session
142
150
  } = useContext(SessionContext) || {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit",
3
- "version": "1.5.75",
3
+ "version": "1.5.77",
4
4
  "description": "A react component for Discuss Kit blocklet.",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/es/index.js",
@@ -37,8 +37,8 @@
37
37
  "@arcblock/did-connect": "^2.7.13",
38
38
  "@arcblock/ux": "^2.7.13",
39
39
  "@arcblock/ws": "^1.18.89",
40
- "@blocklet/discuss-kit-ux": "1.5.75",
41
- "@blocklet/editor": "1.5.75",
40
+ "@blocklet/discuss-kit-ux": "1.5.77",
41
+ "@blocklet/editor": "1.5.77",
42
42
  "@emotion/react": "^11.10.5",
43
43
  "@emotion/styled": "^11.10.5",
44
44
  "@mui/icons-material": "^5.14.3",
@@ -77,5 +77,5 @@
77
77
  "vite-plugin-build": "^0.7.1",
78
78
  "vite-plugin-svgr": "^2.2.2"
79
79
  },
80
- "gitHead": "86cd3bfd725f5deef64cea0e99ac5b4a93f5ad23"
80
+ "gitHead": "9a40bffb02e74a19c2fe5f34badbf8b85b768e0c"
81
81
  }