mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
Use org seed for projects in org view
This commit is contained in:
@@ -220,7 +220,7 @@
|
||||
{:then projects}
|
||||
{#each projects as project}
|
||||
<div class="project">
|
||||
<Project {project} org={org.address} {config} />
|
||||
<Project {project} org={org.address} {config} seed={profile.seed} />
|
||||
</div>
|
||||
{/each}
|
||||
{:catch err}
|
||||
|
||||
@@ -16,13 +16,15 @@
|
||||
export let project: proj.Project;
|
||||
export let config: Config;
|
||||
export let org: string | undefined;
|
||||
export let seed: string | undefined;
|
||||
|
||||
let state: State = { status: Status.Loading };
|
||||
let info: proj.Info | null = null;
|
||||
|
||||
onMount(async () => {
|
||||
try {
|
||||
const result = await proj.getInfo(project.id, config);
|
||||
const cfg = seed ? config.withSeed(seed) : config;
|
||||
const result = await proj.getInfo(project.id, cfg);
|
||||
state = { status: Status.Loaded };
|
||||
info = result;
|
||||
} catch (err) {
|
||||
|
||||
@@ -72,6 +72,15 @@ export class Config {
|
||||
this.provider,
|
||||
);
|
||||
}
|
||||
|
||||
// Return the config with an overwritten seed URL.
|
||||
withSeed(seed: string): Config {
|
||||
const cfg = {} as Config;
|
||||
Object.assign(cfg, this);
|
||||
cfg.seed.api = seed;
|
||||
|
||||
return cfg;
|
||||
}
|
||||
}
|
||||
|
||||
/// Gas limits for various transactions.
|
||||
|
||||
@@ -54,6 +54,11 @@ export class Profile {
|
||||
else return undefined;
|
||||
}
|
||||
|
||||
// Using undefined as return type if nothing to be returned since it works better with <a href> links
|
||||
get seed(): string | undefined {
|
||||
return this.profile?.ens?.seed ?? undefined;
|
||||
}
|
||||
|
||||
// Keeping this function private since the desired entrypoint is .get()
|
||||
private static async lookupAddress(address: string, config: Config): Promise<[IProfile, string]> {
|
||||
const profile: IProfile = { ens: null, idx: null };
|
||||
|
||||
Reference in New Issue
Block a user