refactor(api): switch avatar path to assets
This commit is contained in:
parent
6a65781950
commit
cb2f171d86
@ -14,6 +14,7 @@ export default eventHandler(async (ev) => {
|
||||
}
|
||||
let si = sharp(mpd[0].data!);
|
||||
let nn = v4();
|
||||
// const apath = await import("~/assets/avatars/" + nn + ".png");
|
||||
await si
|
||||
.resize({
|
||||
height: 500,
|
||||
@ -22,7 +23,7 @@ export default eventHandler(async (ev) => {
|
||||
background: { r: 0, g: 0, b: 0, alpha: 0 },
|
||||
})
|
||||
.toFormat("png")
|
||||
.toFile(resolve(`public/avatars/${nn}.png`));
|
||||
.toFile(resolve(process.cwd(), `assets/avatars/${nn}.png`));
|
||||
await User.findByIdAndUpdate(ev.context.currentUser!._id, {
|
||||
$set: {
|
||||
"profile.avatar": nn,
|
||||
|
Loading…
Reference in New Issue
Block a user