Added website image to the creator page and use type of file when uploading pictures. Restriction for .png, .jpeg, .jpg for now

This commit is contained in:
Dominic Villemure
2024-07-10 01:36:41 -04:00
parent bd034d919b
commit 6c23fe005c
4 changed files with 22 additions and 8 deletions

View File

@@ -28,7 +28,7 @@ export const useUserStore = defineStore('user', () => {
const updateProfilePictureEndpoint = haveNewProfilePicture ? `/api/UpdateMyUser/profile-picture` : `/api/UpdateMyUser/profile-picture?url=${myUserModel.storedDataUrls.profilePictureUrl}`;
const response = await client.post(updateProfilePictureEndpoint, profilePicture, {
headers: {
'Content-Type': 'application/octet-stream',
'Content-Type': profilePicture?.type ?? "application/stream-octet",
}
});
@@ -38,14 +38,16 @@ export const useUserStore = defineStore('user', () => {
}
if (typeof myUserModel.storedDataUrls.bannerPictureUrl !== "object") {
const haveNewBannerPicture = bannerPicture !== null && bannerPicture.size !== 0;
const updateBannerPictureEndpoint = haveNewBannerPicture ? `/api/UpdateMyUser/banner-picture` : `/api/UpdateMyUser/banner-picture?url=${myUserModel.storedDataUrls.bannerPictureUrl}`;
const response = await client.post(updateBannerPictureEndpoint, bannerPicture, {
headers: {
'Content-Type': 'application/octet-stream',
'Content-Type': bannerPicture?.type ?? "application/stream-octet",
}
});
console.log(response);
if (haveNewBannerPicture) {
this.user.value.storedDataUrls.bannerPictureUrl = response.data;
}
@@ -56,7 +58,7 @@ export const useUserStore = defineStore('user', () => {
const updateWebsiteIconEndpoint = haveNewWebsiteIcon ? `/api/UpdateMyUser/website-icon` : `/api/UpdateMyUser/website-icon?url=${myUserModel.storedDataUrls.websiteIconUrl}`;
const response = await client.post(updateWebsiteIconEndpoint, websiteIcon, {
headers: {
'Content-Type': 'application/octet-stream',
'Content-Type': websiteIcon?.type ?? "application/stream-octet",
}
});