mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix: invalid campaign image.
This commit is contained in:
1 parent
f9a86217b9
commit
7a121a94d7
3 files changed
+14
-11
No files matched your search
@@ -8,7 +8,7 @@
|
||||
import type { Coupon } from '$lib/sdk/billing';
|
||||
import { app } from '$lib/stores/app';
|
||||
import type { Campaign } from '$lib/stores/campaigns';
|
||||
import { getApiEndpoint } from '$lib/stores/sdk';
|
||||
import { getCampaignImageUrl } from '$routes/(public)/card/helpers';
|
||||
|
||||
export const imgLight = LoginLight;
|
||||
export const imgDark = LoginDark;
|
||||
@@ -38,12 +38,6 @@
|
||||
return campaign.description;
|
||||
}
|
||||
}
|
||||
|
||||
function getImage(image: string) {
|
||||
const endpoint = getApiEndpoint();
|
||||
const url = new URL(image, endpoint);
|
||||
return url.toString();
|
||||
}
|
||||
</script>
|
||||
|
||||
<main class="grid-1-1 is-full-page" id="main">
|
||||
@@ -86,7 +80,7 @@
|
||||
<section
|
||||
class="u-flex u-flex-vertical u-main-center u-cross-center u-height-100-percent u-width-full-line">
|
||||
<img
|
||||
src={getImage(campaign?.image[$app.themeInUse])}
|
||||
src={getCampaignImageUrl(campaign?.image[$app.themeInUse])}
|
||||
class="u-block u-image-object-fit-cover side-bg-img"
|
||||
alt="promo" />
|
||||
|
||||
@@ -151,7 +145,7 @@
|
||||
<div class="u-margin-block-start-16 u-flex u-gap-16">
|
||||
{#if currentReview?.image}
|
||||
<Avatar
|
||||
src={getImage(currentReview?.image)}
|
||||
src={getCampaignImageUrl(currentReview?.image)}
|
||||
name={currentReview.name}
|
||||
size={40} />
|
||||
{:else}
|
||||
@@ -170,7 +164,7 @@
|
||||
<p class="u-bold" style:text-transform="uppercase">provided to you by</p>
|
||||
<img
|
||||
style:max-block-size="2.5rem"
|
||||
src={getImage(campaign?.image[$app.themeInUse])}
|
||||
src={getCampaignImageUrl(campaign?.image[$app.themeInUse])}
|
||||
alt={coupon?.campaign ?? campaign.$id} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
import { ID } from '@appwrite.io/console';
|
||||
import { onMount } from 'svelte';
|
||||
import { writable } from 'svelte/store';
|
||||
import { getCampaignImageUrl } from '$routes/(public)/card/helpers';
|
||||
|
||||
export let data;
|
||||
|
||||
@@ -281,7 +282,7 @@
|
||||
<div class="card-bg"></div>
|
||||
<div class="u-flex u-flex-vertical u-gap-24 u-cross-center u-position-relative">
|
||||
<img
|
||||
src={base + campaign?.image[$app.themeInUse]}
|
||||
src={getCampaignImageUrl(campaign?.image[$app.themeInUse])}
|
||||
class="u-block u-image-object-fit-cover card-img"
|
||||
alt="promo" />
|
||||
<p class="text">
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { getApiEndpoint } from '$lib/stores/sdk';
|
||||
|
||||
export function getCardImgUrls(userId: string, endpoint: string) {
|
||||
const resolved = endpoint;
|
||||
|
||||
@@ -7,3 +9,9 @@ export function getCardImgUrls(userId: string, endpoint: string) {
|
||||
|
||||
return { frontImg, backImg, ogImg };
|
||||
}
|
||||
|
||||
export function getCampaignImageUrl(image: string) {
|
||||
const endpoint = getApiEndpoint();
|
||||
const url = new URL(image, endpoint);
|
||||
return url.toString();
|
||||
}
|
||||
Reference in new issue
Block a user