[WIP] Use nice outfit image paths

This commit is contained in:
Emi Matchu 2021-11-01 22:42:23 -07:00
parent 52526c09e8
commit 5b0919f23b
2 changed files with 12 additions and 8 deletions

View file

@ -2,6 +2,18 @@ module.exports = {
env: { env: {
PUBLIC_URL: "", PUBLIC_URL: "",
}, },
async rewrites() {
return [
{
source: "/outfits/:id/:size(150|300|600).png",
destination: "/api/outfitImage?size=:size&id=:id",
},
{
source: "/outfits/:id/v/:updatedAt/:size(150|300|600).png",
destination: "/api/outfitImage?size=:size&id=:id&updatedAt=:updatedAt",
},
];
},
async redirects() { async redirects() {
return [ return [
{ {

View file

@ -1,13 +1,5 @@
{ {
"routes": [ "routes": [
{
"src": "/outfits/(?<id>[^/]+)/(?<size>150|300|600)\\.png",
"dest": "/api/outfitImage.js?size=$size&id=$id"
},
{
"src": "/outfits/(?<id>[^/]+)/v/(?<updatedAt>[^/]+)/(?<size>150|300|600)\\.png",
"dest": "/api/outfitImage.js?size=$size&id=$id&updatedAt=$updatedAt"
},
{ "src": "/outfits/new(\\?|$)", "dest": "/index.html" }, { "src": "/outfits/new(\\?|$)", "dest": "/index.html" },
{ "src": "/outfits/(?<id>[^/]+)", "dest": "/api/outfitPageSSR.js?id=$id" }, { "src": "/outfits/(?<id>[^/]+)", "dest": "/api/outfitPageSSR.js?id=$id" },
{ {