Update background message name
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import type { PlasmoMessaging } from "@plasmohq/messaging";
|
||||
|
||||
const handler: PlasmoMessaging.MessageHandler = async (req, res) => {
|
||||
const { token, siteUrl } = await chrome.storage.local.get(["token", "siteUrl"]);
|
||||
|
||||
// 更新追番进度
|
||||
if (req.body.action === "updateBangumiProgress") {
|
||||
const { values } = req.body;
|
||||
|
||||
const updateRequest = await fetch(`${siteUrl}/api/bangumi/update`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(values),
|
||||
headers: {
|
||||
"paul-token-code": token,
|
||||
},
|
||||
}).then((res) => res.json());
|
||||
|
||||
res.send(updateRequest);
|
||||
}
|
||||
}
|
||||
|
||||
export default handler;
|
||||
Reference in New Issue
Block a user