Skip to content

Commit

Permalink
change: imageUrl returns default when null
Browse files Browse the repository at this point in the history
  • Loading branch information
NiiMiyo committed Nov 29, 2023
1 parent 8ebf492 commit fd36cbe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/types/Profile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { User } from "@/types/User";
import { type Nullable } from "@/types/utils";
import { IMG_DEFAULT_PROFILE } from "@/utils/assets";

export type Gender = "M" | "F" | "O";
export const GenderOptions: {[k in Gender]: string} = {
Expand Down Expand Up @@ -56,7 +57,7 @@ export class ProfileClass implements Profile {
*/
get imageUrl() {
if (this.image === null)
return null;
return IMG_DEFAULT_PROFILE;

return import.meta.env.VITE_UNIVERSIME_API + "/profile/image/" + this.id;
}
Expand Down
5 changes: 3 additions & 2 deletions src/utils/assets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const IMG_UNIVERSI_LOGO = "/assets/imgs/universi-me2.png";
export const IMG_DCX_LOGO = "/assets/imgs/dcx-png 1.png";
export const IMG_UNIVERSI_LOGO = "/assets/imgs/universi-me2.png";
export const IMG_DCX_LOGO = "/assets/imgs/dcx-png 1.png";
export const IMG_DEFAULT_PROFILE = "/assets/imgs/default_avatar.png";

export const ICON_CHEVRON_DOWN = "/assets/icons/chevron-down-1.svg";
export const ICON_CHEVRON_UP_BLACK = "/assets/icons/chevron-up-black.svg";
Expand Down

0 comments on commit fd36cbe

Please sign in to comment.