tangled
alpha
login
or
join now
bas.sh
/
pdsls
forked from
pds.ls/pdsls
0
fork
atom
atmosphere explorer
0
fork
atom
overview
issues
pulls
pipelines
fallback when describeRepo fails
handle.invalid
3 months ago
dfda14be
5051ef47
verified
This commit was signed with the committer's
known signature
.
handle.invalid
SSH Key Fingerprint:
SHA256:mBrT4x0JdzLpbVR95g1hjI1aaErfC02kmLRkPXwsYCk=
+32
-28
1 changed file
expand all
collapse all
unified
split
src
views
repo.tsx
+32
-28
src/views/repo.tsx
···
140
140
}
141
141
142
142
rpc = new Client({ handler: new CredentialManager({ service: pds }) });
143
143
-
const res = await rpc.get("com.atproto.repo.describeRepo", {
144
144
-
params: { repo: did as ActorIdentifier },
145
145
-
});
146
146
-
if (res.ok) {
147
147
-
const collections: Record<string, { hidden: boolean; nsids: string[] }> = {};
148
148
-
res.data.collections.forEach((c) => {
149
149
-
const nsid = c.split(".");
150
150
-
if (nsid.length > 2) {
151
151
-
const authority = `${nsid[0]}.${nsid[1]}`;
152
152
-
collections[authority] = {
153
153
-
nsids: (collections[authority]?.nsids ?? []).concat(nsid.slice(2).join(".")),
154
154
-
hidden: false,
155
155
-
};
156
156
-
}
143
143
+
try {
144
144
+
const res = await rpc.get("com.atproto.repo.describeRepo", {
145
145
+
params: { repo: did as ActorIdentifier },
157
146
});
158
158
-
setNsids(collections);
159
159
-
} else {
160
160
-
console.error(res.data.error);
161
161
-
switch (res.data.error) {
162
162
-
case "RepoDeactivated":
163
163
-
setError("Deactivated");
164
164
-
break;
165
165
-
case "RepoTakendown":
166
166
-
setError("Takendown");
167
167
-
break;
168
168
-
default:
169
169
-
setError("Unreachable");
147
147
+
if (res.ok) {
148
148
+
const collections: Record<string, { hidden: boolean; nsids: string[] }> = {};
149
149
+
res.data.collections.forEach((c) => {
150
150
+
const nsid = c.split(".");
151
151
+
if (nsid.length > 2) {
152
152
+
const authority = `${nsid[0]}.${nsid[1]}`;
153
153
+
collections[authority] = {
154
154
+
nsids: (collections[authority]?.nsids ?? []).concat(nsid.slice(2).join(".")),
155
155
+
hidden: false,
156
156
+
};
157
157
+
}
158
158
+
});
159
159
+
setNsids(collections);
160
160
+
} else {
161
161
+
console.error(res.data.error);
162
162
+
switch (res.data.error) {
163
163
+
case "RepoDeactivated":
164
164
+
setError("Deactivated");
165
165
+
break;
166
166
+
case "RepoTakendown":
167
167
+
setError("Takendown");
168
168
+
break;
169
169
+
default:
170
170
+
setError("Unreachable");
171
171
+
}
170
172
}
173
173
+
174
174
+
return res.data;
175
175
+
} catch {
176
176
+
return {};
171
177
}
172
172
-
173
173
-
return res.data;
174
178
};
175
179
176
180
const [repo] = createResource(fetchRepo);