Skip to content
Prev Previous commit
Next Next commit
move states
  • Loading branch information
f0ssel committed Nov 14, 2022
commit 991b518986129efcb27b20b7a79c0777f8eb62c4
6 changes: 3 additions & 3 deletions site/src/xServices/template/searchUsersAndGroupsXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ export const searchUsersAndGroupsMachine = createMachine(
{
services: {
search: async ({ organizationId }, { query }) => {
const [users, groups] = await Promise.all([
(await getUsers(queryToFilter(query))).users,
const [userRes, groups] = await Promise.all([
getUsers(queryToFilter(query)),
getGroups(organizationId),
])

// The Everyone groups is not returned by the API so we have to add it
// manually
return { users, groups: [everyOneGroup(organizationId), ...groups] }
return { users: userRes.users, groups: [everyOneGroup(organizationId), ...groups] }
},
},
actions: {
Expand Down
13 changes: 4 additions & 9 deletions site/src/xServices/users/usersXService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,13 @@ export const usersMachine =
id: "usersState",
on: {
UPDATE_FILTER: {
target: ".gettingUsers",
actions: ["assignFilter", "sendResetPage"],
internal: false,
},
UPDATE_PAGE: {
target: "gettingUsers",
actions: "updateURL",
},
},
initial: "startingPagination",
states: {
Expand Down Expand Up @@ -201,14 +204,6 @@ export const usersMachine =
target: "updatingUserRoles",
actions: "assignUserIdToUpdateRoles",
},
UPDATE_PAGE: {
target: "gettingUsers",
actions: "updateURL",
},
UPDATE_FILTER: {
target: "gettingUsers",
actions: ["assignFilter", "sendResetPage"],
},
},
},
confirmUserSuspension: {
Expand Down