我无法从 supabase 下载图像。我得到这个错误
{
"statusCode": "400",
"error": "Bad Request",
"message": "headers should have required property 'authorization'"
}
我已经关注了文档 https://supabase.io/docs/guides/with-nextjs
这是我的请求代码
const myQuote = ({ dataFetch }) => {
const [avatarUrl, setAvatarUrl] = useState(null);
async function downloadImage(path) {
try {
const { data, error } = await supabase.storage
.from("job-photo")
.download(`jobphotos/${path}.jpg`);
if (error) {
throw error;
}
const url = URL.createObjectURL(data);
setAvatarUrl(url);
} catch (error) {
console.log("Error downloading image: ", error.message);
}
}
return (
<>
<Dashboard />
<QuoteTable tableData={dataFetch} downloadImg={downloadImage} />
</>
);
};
export default myQuote;