InviteList: load() keeps its own error line; revoke toasts
ebbe4a6 converted the wrong try block in InviteList: the edit matched from
load()'s try down to revoke()'s catch, which left load() half-converted.
load() goes back to its own try/catch/finally. revoke() uses
toastOnFailure, as intended.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,6 @@ const LIFETIMES = [
|
|||||||
{ days: 30, label: "30 days" },
|
{ days: 30, label: "30 days" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
const invites = ref<Invite[]>([]);
|
const invites = ref<Invite[]>([]);
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const error = ref("");
|
const error = ref("");
|
||||||
@@ -41,7 +40,7 @@ const freshLink = ref("");
|
|||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
error.value = "";
|
error.value = "";
|
||||||
await toastOnFailure(async () => {
|
try {
|
||||||
invites.value = (await api.get<{ invites: Invite[] }>("/api/invites")).invites;
|
invites.value = (await api.get<{ invites: Invite[] }>("/api/invites")).invites;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error.value = errorMessage(e, "Couldn't load invites.");
|
error.value = errorMessage(e, "Couldn't load invites.");
|
||||||
@@ -71,7 +70,7 @@ async function create() {
|
|||||||
|
|
||||||
async function revoke(invite: Invite) {
|
async function revoke(invite: Invite) {
|
||||||
if (!window.confirm(`Revoke the invite for ${who(invite)}? Its link will stop working.`)) return;
|
if (!window.confirm(`Revoke the invite for ${who(invite)}? Its link will stop working.`)) return;
|
||||||
try {
|
await toastOnFailure(async () => {
|
||||||
const updated = await api.del<Invite>(`/api/invites/${invite.id}`);
|
const updated = await api.del<Invite>(`/api/invites/${invite.id}`);
|
||||||
invites.value = invites.value.map((i) => (i.id === updated.id ? updated : i));
|
invites.value = invites.value.map((i) => (i.id === updated.id ? updated : i));
|
||||||
}, "Couldn't revoke that invite.");
|
}, "Couldn't revoke that invite.");
|
||||||
|
|||||||
Reference in New Issue
Block a user