mirror of
https://github.com/immich-app/immich.git
synced 2026-02-28 17:49:05 +03:00
refactor: purchase store (#25734)
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
import LicenseActivationSuccess from '$lib/components/shared-components/purchasing/purchase-activation-success.svelte';
|
||||
import LicenseContent from '$lib/components/shared-components/purchasing/purchase-content.svelte';
|
||||
import SupporterBadge from '$lib/components/shared-components/side-bar/supporter-badge.svelte';
|
||||
import { authManager } from '$lib/managers/auth-manager.svelte';
|
||||
import { Route } from '$lib/route';
|
||||
import { purchaseStore } from '$lib/stores/purchase.store';
|
||||
import { Alert, Container, Stack } from '@immich/ui';
|
||||
import { mdiAlertCircleOutline } from '@mdi/js';
|
||||
import { t } from 'svelte-i18n';
|
||||
@@ -17,17 +17,16 @@
|
||||
|
||||
let { data }: Props = $props();
|
||||
let showLicenseActivated = $state(false);
|
||||
const { isPurchased } = purchaseStore;
|
||||
</script>
|
||||
|
||||
<UserPageLayout title={$t('buy')}>
|
||||
<UserPageLayout title={data.meta.title}>
|
||||
<Container size="medium" center>
|
||||
<Stack gap={4} class="mt-4">
|
||||
{#if data.isActivated === false}
|
||||
<Alert icon={mdiAlertCircleOutline} color="danger" title={$t('purchase_failed_activation')} />
|
||||
{/if}
|
||||
|
||||
{#if $isPurchased}
|
||||
{#if authManager.isPurchased}
|
||||
<SupporterBadge logoSize="lg" centered />
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { purchaseStore } from '$lib/stores/purchase.store';
|
||||
import { authManager } from '$lib/managers/auth-manager.svelte';
|
||||
import { authenticate } from '$lib/utils/auth';
|
||||
import { getFormatter } from '$lib/utils/i18n';
|
||||
import { activateProduct, getActivationKey } from '$lib/utils/license-utils';
|
||||
@@ -21,7 +21,7 @@ export const load = (async ({ url }) => {
|
||||
const response = await activateProduct(licenseKey, activationKey);
|
||||
if (response.activatedAt !== '') {
|
||||
isActivated = true;
|
||||
purchaseStore.setPurchaseStatus(true);
|
||||
authManager.isPurchased = true;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user