moved the dispatch call to change as to be after the navigation

This commit is contained in:
csawatzky 2025-05-15 14:37:20 -06:00
parent 2c2fda4817
commit a7ed8ccb21

View file

@ -80,24 +80,24 @@ export default function AccessObject(props: Props) {
const getAccess = (key: number | string, name: string, url: string, useImitation = false) => { const getAccess = (key: number | string, name: string, url: string, useImitation = false) => {
user.settings.useTeam = false; user.settings.useTeam = false;
dispatch({ key: "as", value: "" });
userAPI.updateUser(user.id(), user.protobuf()).then(() => { userAPI.updateUser(user.id(), user.protobuf()).then(() => {
info("Will no longer view as team by default"); info("Will no longer view as team by default");
permissionAPI permissionAPI
.shareObject( .shareObject(
newScope(kind, key.toString()), newScope(kind, key.toString()),
user.settings.email, user.settings.email,
[ [
pond.Permission.PERMISSION_USERS, pond.Permission.PERMISSION_USERS,
pond.Permission.PERMISSION_READ, pond.Permission.PERMISSION_READ,
pond.Permission.PERMISSION_WRITE, pond.Permission.PERMISSION_WRITE,
pond.Permission.PERMISSION_SHARE pond.Permission.PERMISSION_SHARE
], ],
useImitation useImitation
) )
.then((_response: any) => { .then((_response: any) => {
// history.push(url); // history.push(url);
navigate(url) navigate(url)
dispatch({ key: "as", value: "" });
close(); close();
}) })
.catch((_err: any) => { .catch((_err: any) => {