Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
oeyoews committed Apr 2, 2024
1 parent b730bbf commit 165dde1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "usewiki2",
"description": "Convert HTML to Markdown, and save to your computer, support nodejs tiddlywiki",
"private": true,
"version": "1.5.4",
"version": "1.5.5",
"type": "module",
"scripts": {
"dev": "wxt",
Expand Down
21 changes: 9 additions & 12 deletions utils/checkStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ export async function checkStatus(
const baseURL = `http://localhost:${port}`;
const twFetch = ofetch.create({
baseURL,
retry: 0,
onResponse({ request, response, options }) {
if (response.ok) {
notify({
message: 'TiddlyWiki 连接成功',
type: 'success',
});
}
},
async onRequestError({ request, response, options }) {
notify({
message: 'TiddlyWiki 未成功连接',
Expand All @@ -23,16 +32,4 @@ export async function checkStatus(
});

status.value = data;

if (!data.tiddlywiki_version) {
notify({
message: 'TiddlyWiki 未连接',
type: 'error',
});
} else {
notify({
message: 'TiddlyWiki 连接成功',
type: 'success',
});
}
}
3 changes: 2 additions & 1 deletion utils/save2TiddlyWiki.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ const save2TiddlyWiki = async (
const baseURL = `http://localhost:${port}`;
const savetwFetch = ofetch.create({
baseURL,
retry: 0,
async onResponse({ request, response, options }) {
if (response.status === 204) {
if (response.ok) {
notify({
message: '保存成功',
type: 'success',
Expand Down

0 comments on commit 165dde1

Please sign in to comment.