「POST」操作のためにワークボックスでバックグラウンドキュー構成を行っています。workbox-config.js の「runtimeCaching」構成内で「POST」操作のオプションを指定する場所を教えてください。
module.exports = {
"globDirectory": "dist/",
"globPatterns": [
"**/*.{txt,ico,html,js,css}"
],
"swDest": "dist\\sw.js",
runtimeCaching: [{
urlPattern: /api/,
handler: 'NetworkOnly',
options: {
// Configure background sync.
backgroundSync: {
name: 'product-bgsync-queue1',
options: {
maxRetentionTime: 24 * 60 * 60,
},
},
},
}]
};
上記のコードは、dist/sw.js の「GET」のデフォルト構成を生成します。
workbox.routing.registerRoute(/api/,
new workbox.strategies.NetworkOnly({
plugins:[
new workbox.backgroundSync.Plugin("product-bgsync-queue1",
{
maxRetentionTime:86400
} )
]
}),
'GET');
「POST」操作用に同じ構成を生成する方法を教えてください。