Skip to content

Commit fcc735a

Browse files
bugfix topic captcha
1 parent cd2ec3e commit fcc735a

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

site/src/pages/topic/[id].vue

+8-2
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@
187187

188188
<script setup>
189189
const route = useRoute();
190-
const hideContent = ref(null);
191190
192191
const { data: topic } = await useAsyncData("topic", () =>
193192
useHttpGet(`/api/topic/${route.params.id}`)
@@ -208,6 +207,13 @@ const { data: likeUsers, refresh: refreshLikeUsers } = await useAsyncData(
208207
}
209208
);
210209
210+
211+
const { data: hideContent, refresh: refreshHideContent } = await useAsyncData(
212+
() => {
213+
return useHttpGet(`/api/topic/hide_content?topicId=${route.params.id}`);
214+
}
215+
);
216+
211217
const imageUrls = computed(() => {
212218
if (!topic.value.imageList || !topic.value.imageList.length) {
213219
return [];
@@ -287,7 +293,7 @@ async function addFavorite(topicId) {
287293
}
288294
289295
async function commentCreated() {
290-
console.log("commentCreated...");
296+
refreshHideContent();
291297
}
292298
</script>
293299

site/src/pages/topic/create.vue

+10-4
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,11 @@ const publish = () => {
173173
return;
174174
}
175175
176-
if (topicCaptchaEnabled) {
176+
console.log(configStore.config);
177+
178+
console.log(topicCaptchaEnabled.value);
179+
180+
if (topicCaptchaEnabled.value) {
177181
captchaDialog.value.show().then((captcha) => {
178182
publishSubmit(captcha);
179183
});
@@ -194,9 +198,11 @@ const publishSubmit = async (captcha) => {
194198
}
195199
}
196200
197-
postForm.value.captchaId = captcha.captchaId;
198-
postForm.value.captchaCode = captcha.captchaCode;
199-
postForm.value.captchaProtocol = 2;
201+
if (captcha) {
202+
postForm.value.captchaId = captcha.captchaId;
203+
postForm.value.captchaCode = captcha.captchaCode;
204+
postForm.value.captchaProtocol = 2;
205+
}
200206
201207
publishing.value = true;
202208
try {

0 commit comments

Comments
 (0)