refactor: more TS code

This commit is contained in:
Tristan Yang
2022-07-14 22:22:05 +08:00
parent c2797a132c
commit 65049677e4
12 changed files with 54 additions and 33 deletions
+1 -2
View File
@@ -50,12 +50,11 @@ export const channelApi = createApi({
}),
async onQueryStarted({ id, name, description }, { dispatch, queryFulfilled }) {
// id: who send to ,from_uid: who sent
const patchResult = dispatch(updateChannel({ gid: id, name, description }));
dispatch(updateChannel({ gid: id, name, description }));
try {
await queryFulfilled;
} catch {
console.log("channel update failed");
patchResult.undo();
}
}
}),