Remove usage of tiley (#4406)

* First pass

* Mooarrr

* lint

* snapshots
This commit is contained in:
Tom Moor
2022-11-08 17:12:22 -08:00
committed by GitHub
parent 920b58c006
commit 587f062677
38 changed files with 169 additions and 177 deletions

View File

@@ -226,14 +226,17 @@ export default class AuthStore {
preferences?: UserPreferences;
}) => {
this.isSaving = true;
const previousData = this.user?.toAPI();
try {
this.user?.updateFromJson(params);
const res = await client.post(`/users.update`, params);
invariant(res?.data, "User response not available");
runInAction("AuthStore#updateUser", () => {
this.addPolicies(res.policies);
this.user = new User(res.data, this);
});
this.user?.updateFromJson(res.data);
this.addPolicies(res.policies);
} catch (err) {
this.user?.updateFromJson(previousData);
throw err;
} finally {
this.isSaving = false;
}
@@ -251,14 +254,17 @@ export default class AuthStore {
preferences?: TeamPreferences;
}) => {
this.isSaving = true;
const previousData = this.team?.toAPI();
try {
this.team?.updateFromJson(params);
const res = await client.post(`/team.update`, params);
invariant(res?.data, "Team response not available");
runInAction("AuthStore#updateTeam", () => {
this.addPolicies(res.policies);
this.team = new Team(res.data, this);
});
this.team?.updateFromJson(res.data);
this.addPolicies(res.policies);
} catch (err) {
this.team?.updateFromJson(previousData);
throw err;
} finally {
this.isSaving = false;
}