Skip to content

Commit

Permalink
Private groups - Update API
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed Dec 10, 2024
1 parent 1a3ba40 commit 32f170c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/components/modules/groups/GroupName.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ export async function validateNameStep(values, errors) {
for (let i = 0; i < 3; ++i) {
try {
console.time('group_exists')
group = await api.getGroupsAsync({
group = (await api.getGroupsAsync({
start_group: values.name,
limit: 1
})
})).groups
console.timeEnd('group_exists')
break
} catch (err) {
console.error(err)
errors.name = 'Blockchain unavailable :('
}
}
if (group && group[0] && group[0].name === values.name) {
if (group[0] && group[0].name === values.name) {
errors.name = tt('create_group_jsx.group_already_exists')
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/redux/FetchDataSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ export function* fetchState(location_change_action) {
}
})
if (hasErr) return
if (the_group[0] && the_group[0].name === path) {
the_group = the_group[0]
if (the_group && the_group.groups && the_group.groups[0] && the_group.groups[0].name === path) {
the_group = the_group.groups[0]
} else {
the_group = null
}
Expand Down Expand Up @@ -226,24 +226,24 @@ export function* watchFetchMyGroups() {

export function* fetchMyGroups({ payload: { account } }) {
try {
const groupsOwn = yield call([api, api.getGroupsAsync], {
const groupsOwn = (yield call([api, api.getGroupsAsync], {
member: account,
member_types: [],
start_group: '',
limit: 100,
with_members: {
accounts: [account]
}
})
let groups = yield call([api, api.getGroupsAsync], {
})).groups
let groups = (yield call([api, api.getGroupsAsync], {
member: account,
member_types: ['pending', 'member', 'moder'],
start_group: '',
limit: 100,
with_members: {
accounts: [account]
}
})
})).groups
groups = [...groupsOwn, ...groups]
groups.sort((a, b) => {
return b.pendings - a.pendings
Expand All @@ -269,7 +269,7 @@ export function* fetchTopGroups({ payload: { account } }) {
groupsWithoutMe.pop()
}

const groups = yield call([api, api.getGroupsAsync], {
const { groups } = yield call([api, api.getGroupsAsync], {
sort: 'by_popularity',
start_group,
limit: 100,
Expand Down Expand Up @@ -310,7 +310,7 @@ export function* fetchGroupMembers({ payload: { group, creatingNew, memberTypes,

yield put(g.actions.receiveGroupMembers({ group, loading: true }))

const members = yield call([api, api.getGroupMembersAsync], {
const { members } = yield call([api, api.getGroupMembersAsync], {
group,
member_types: memberTypes,
sort_conditions: sortConditions,
Expand Down

0 comments on commit 32f170c

Please sign in to comment.