|
|
@ -15,7 +15,7 @@ export const fetchGroup = (id: string): AppThunkAction => { |
|
|
|
|
|
|
|
try { |
|
|
|
const group = await apiFetch<Entity>({ |
|
|
|
path: `/api/group/${id}` |
|
|
|
path: `/v1/group/${id}` |
|
|
|
}) |
|
|
|
|
|
|
|
const groups = normalize([group], EntityType.Group) |
|
|
@ -39,7 +39,7 @@ export const fetchGroups = (sort?: string, continuation?: string): AppThunkActio |
|
|
|
|
|
|
|
try { |
|
|
|
const response = await apiFetch<GroupsResponse>({ |
|
|
|
path: `/api/groups?${objectToQuerystring({ sort, continuation })}`, |
|
|
|
path: `/v1/groups?${objectToQuerystring({ sort, continuation })}`, |
|
|
|
}) |
|
|
|
|
|
|
|
const groups = normalize(response.groups, EntityType.Group) |
|
|
@ -69,7 +69,7 @@ export const fetchGroupMembers = (id: string, type?: string, continuation?: stri |
|
|
|
|
|
|
|
try { |
|
|
|
const response = await apiFetch<GroupMembersResponse>({ |
|
|
|
path: `/api/group/${id}/members?${objectToQuerystring({ type, continuation })}`, |
|
|
|
path: `/v1/group/${id}/members?${objectToQuerystring({ type, continuation })}`, |
|
|
|
}) |
|
|
|
|
|
|
|
const users = normalize(response.members, EntityType.User) |
|
|
@ -94,12 +94,12 @@ interface GroupLogsResponse { |
|
|
|
continuation?: string |
|
|
|
} |
|
|
|
|
|
|
|
export const fetchLogs = (id: string, continuation?: string): AppThunkAction => async dispatch => { |
|
|
|
export const fetchLogs = (continuation?: string): AppThunkAction => async dispatch => { |
|
|
|
dispatch(startRequest(RequestKey.FetchGroupLogs)) |
|
|
|
|
|
|
|
try { |
|
|
|
const response = await apiFetch<GroupLogsResponse>({ |
|
|
|
path: `/api/group/${id}/logs?${objectToQuerystring({ continuation })}`, |
|
|
|
path: `/v1/group/logs?${objectToQuerystring({ continuation })}`, |
|
|
|
}) |
|
|
|
|
|
|
|
const logs = normalize(response.logs, EntityType.Log) |
|
|
@ -123,12 +123,12 @@ interface CreateInvitationResponse { |
|
|
|
code: string |
|
|
|
} |
|
|
|
|
|
|
|
export const createInvitation = (id: string, expiration?: number, limit?: number): AppThunkAction<string> => async dispatch => { |
|
|
|
export const createInvitation = (expiration?: number, limit?: number): AppThunkAction<string> => async dispatch => { |
|
|
|
dispatch(startRequest(RequestKey.CreateInvitation)) |
|
|
|
|
|
|
|
try { |
|
|
|
const response = await apiFetch<CreateInvitationResponse>({ |
|
|
|
path: `/api/group/${id}/invitation`, |
|
|
|
path: `/v1/group/invitation`, |
|
|
|
method: 'post', |
|
|
|
body: { |
|
|
|
expiration, |
|
|
@ -149,12 +149,12 @@ interface InvitationsResponse { |
|
|
|
continuation?: string |
|
|
|
} |
|
|
|
|
|
|
|
export const fetchInvitations = (id: string): AppThunkAction => async dispatch => { |
|
|
|
export const fetchInvitations = (): AppThunkAction => async dispatch => { |
|
|
|
dispatch(startRequest(RequestKey.FetchInvitations)) |
|
|
|
|
|
|
|
try { |
|
|
|
const response = await apiFetch<InvitationsResponse>({ |
|
|
|
path: `/api/group/${id}/invitations`, |
|
|
|
path: `/v1/group/invitations`, |
|
|
|
}) |
|
|
|
|
|
|
|
const invitations = normalize(response.invitations, EntityType.Invitation) |
|
|
@ -173,7 +173,7 @@ export const updateGroup = (id: string, updates: object): AppThunkAction => asyn |
|
|
|
|
|
|
|
try { |
|
|
|
await apiFetch({ |
|
|
|
path: `/api/group/${id}`, |
|
|
|
path: `/v1/group/${id}`, |
|
|
|
method: 'put', |
|
|
|
body: updates, |
|
|
|
}) |
|
|
|