-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add messaging tab[WTEL-3529]
- Loading branch information
Showing
15 changed files
with
738 additions
and
57 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/modules/contacts/modules/messaging/api/MessagingAPI.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { getDefaultGetParams } from '@webitel/ui-sdk/src/api/defaults'; | ||
import applyTransform, { | ||
merge, notify, | ||
sanitize, snakeToCamel, starToSearch | ||
} from '@webitel/ui-sdk/src/api/transformers'; | ||
import { IMClientsApiFactory } from 'webitel-sdk'; | ||
import getDefaultGetListResponse | ||
from '../../../../../app/api/defaults/getDefaultGetListResponse'; | ||
import configuration from '../../../../../app/api/openAPIConfig'; | ||
import instance from '../../../../../app/api/instance'; | ||
|
||
const service = new IMClientsApiFactory(configuration, '', instance); | ||
|
||
const getList = async (params) => { | ||
const { | ||
parentId, | ||
page, | ||
size, | ||
q, | ||
sort, | ||
fields, | ||
id, | ||
} = applyTransform(params, [ | ||
merge(getDefaultGetParams()), | ||
starToSearch('q'), | ||
]); | ||
try { | ||
const response = await service.listIMClients( | ||
parentId, | ||
page, | ||
size, | ||
q, | ||
sort, | ||
fields, | ||
id, | ||
); | ||
const { data, next } = applyTransform(response.data, [ | ||
snakeToCamel(), | ||
merge(getDefaultGetListResponse()), | ||
]); | ||
return { | ||
items: applyTransform(data, []), | ||
next, | ||
}; | ||
} catch (err) { | ||
throw applyTransform(err, [ | ||
notify, | ||
]); | ||
} | ||
}; | ||
|
||
export default { | ||
getList, | ||
}; |
Oops, something went wrong.