mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-30 16:50:47 +08:00
Only enable record editing for owner
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
<script lang="typescript">
|
||||
import { getRegistration } from './registrar';
|
||||
import type { Registration } from './registrar';
|
||||
import type { Config } from '@app/config';
|
||||
import { session } from '@app/session';
|
||||
import Loading from '@app/Loading.svelte';
|
||||
import Link from '@app/Link.svelte';
|
||||
import Modal from '@app/Modal.svelte';
|
||||
|
||||
export let subdomain: string;
|
||||
export let config: Config;
|
||||
|
||||
$: isOwner = (registration: Registration): boolean => {
|
||||
return registration.owner === ($session && $session.address);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@@ -38,16 +44,16 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div>
|
||||
{#if !registration.address}
|
||||
<button class="tiny primary">
|
||||
Set
|
||||
</button>
|
||||
{/if}
|
||||
<button class="tiny primary" disabled={!isOwner(registration)}>
|
||||
Set
|
||||
</button>
|
||||
</div>
|
||||
<!-- Owner -->
|
||||
<div class="label">Owner</div>
|
||||
<div>{registration.owner}</div>
|
||||
<div><button class="tiny secondary">Transfer</button></div>
|
||||
<div>
|
||||
<button class="tiny secondary" disabled={!isOwner(registration)}>Transfer</button>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
{:else}
|
||||
|
||||
@@ -22,7 +22,7 @@ const registrarAbi = [
|
||||
{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"valid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"}
|
||||
];
|
||||
|
||||
interface Registration {
|
||||
export interface Registration {
|
||||
name: string
|
||||
owner: string
|
||||
address: string | null
|
||||
|
||||
Reference in New Issue
Block a user