@@ -3,6 +3,7 @@ import { axiosInstance as axios } from './requestInterceptor'
33import { CONNECT_MESSAGE_API_URL } from '../config/constants'
44
55const timeout = 1.5 * 60 * 1000
6+ const apiBaseUrl = CONNECT_MESSAGE_API_URL
67
78export function getTopics ( criteria ) {
89 const params = { }
@@ -14,7 +15,7 @@ export function getTopics(criteria) {
1415 params . filter = filterStr . join ( '&' )
1516 }
1617
17- return axios . get ( `${ CONNECT_MESSAGE_API_URL } /v4/ topics/` , { params } )
18+ return axios . get ( `${ apiBaseUrl } / topics/list ` , { params } )
1819 . then ( resp => {
1920 return {
2021 totalCount : _ . get ( resp . data , 'result.metadata.totalCount' , 0 ) ,
@@ -24,7 +25,7 @@ export function getTopics(criteria) {
2425}
2526
2627export function getTopic ( topicId ) {
27- return axios . get ( `${ CONNECT_MESSAGE_API_URL } /v4/ topics/${ topicId } ` )
28+ return axios . get ( `${ apiBaseUrl } / topics/${ topicId } /read ` )
2829 . then ( resp => {
2930 return {
3031 totalCount : _ . get ( resp . data , 'result.metadata.totalCount' , 0 ) ,
@@ -36,7 +37,7 @@ export function getTopic(topicId) {
3637
3738export function getTopicPosts ( topicId , postIds ) {
3839 const params = { postIds : postIds . join ( ',' ) }
39- return axios . get ( `${ CONNECT_MESSAGE_API_URL } /v4/ topics/${ topicId } /posts` , { params } )
40+ return axios . get ( `${ apiBaseUrl } / topics/${ topicId } /posts/list ` , { params } )
4041 . then ( resp => {
4142 return {
4243 totalCount : _ . get ( resp . data , 'result.metadata.totalCount' , 0 ) ,
@@ -47,21 +48,21 @@ export function getTopicPosts(topicId, postIds) {
4748}
4849
4950export function createTopic ( topicProps ) {
50- return axios . post ( `${ CONNECT_MESSAGE_API_URL } /v4/ topics/` , topicProps , { timeout } )
51+ return axios . post ( `${ apiBaseUrl } / topics/create ` , topicProps , { timeout } )
5152 . then ( resp => {
5253 return _ . get ( resp . data , 'result.content' , { } )
5354 } )
5455}
5556
5657export function saveTopic ( topicId , topicProps ) {
57- return axios . post ( `${ CONNECT_MESSAGE_API_URL } /v4 /topics/${ topicId } /edit` , topicProps , { timeout } )
58+ return axios . post ( `${ apiBaseUrl } /topics/${ topicId } /edit` , topicProps , { timeout } )
5859 . then ( resp => {
5960 return _ . get ( resp . data , 'result.content' , { } )
6061 } )
6162}
6263
6364export function deleteTopic ( topicId ) {
64- return axios . delete ( `${ CONNECT_MESSAGE_API_URL } /v4/ topics/${ topicId } ` , null , { timeout } )
65+ return axios . delete ( `${ apiBaseUrl } / topics/${ topicId } /remove ` , null , { timeout } )
6566 . then ( resp => {
6667 return {
6768 result : _ . get ( resp . data , 'result.content' , { } )
@@ -70,7 +71,7 @@ export function deleteTopic(topicId) {
7071}
7172
7273export function addTopicPost ( topicId , post ) {
73- return axios . post ( `${ CONNECT_MESSAGE_API_URL } /v4/ topics/${ topicId } /posts` , { post : post . content } , { timeout } )
74+ return axios . post ( `${ apiBaseUrl } / topics/${ topicId } /posts/create ` , { post : post . content } , { timeout } )
7475 . then ( resp => {
7576 return {
7677 topicId,
@@ -80,7 +81,7 @@ export function addTopicPost(topicId, post) {
8081}
8182
8283export function saveTopicPost ( topicId , post ) {
83- return axios . post ( `${ CONNECT_MESSAGE_API_URL } /v4 /topics/${ topicId } /posts/${ post . id } /edit` , { post : post . content } , { timeout } )
84+ return axios . post ( `${ apiBaseUrl } /topics/${ topicId } /posts/${ post . id } /edit` , { post : post . content } , { timeout } )
8485 . then ( resp => {
8586 return {
8687 topicId,
@@ -90,7 +91,7 @@ export function saveTopicPost(topicId, post) {
9091}
9192
9293export function getTopicPost ( topicId , postId ) {
93- return axios . get ( `${ CONNECT_MESSAGE_API_URL } /v4/ topics/${ topicId } /posts/${ postId } ` , null , { timeout } )
94+ return axios . get ( `${ apiBaseUrl } / topics/${ topicId } /posts/${ postId } /read ` , null , { timeout } )
9495 . then ( resp => {
9596 return {
9697 topicId,
@@ -100,7 +101,7 @@ export function getTopicPost(topicId, postId) {
100101}
101102
102103export function deleteTopicPost ( topicId , postId ) {
103- return axios . delete ( `${ CONNECT_MESSAGE_API_URL } /v4/ topics/${ topicId } /posts/${ postId } ` , null , { timeout } )
104+ return axios . delete ( `${ apiBaseUrl } / topics/${ topicId } /posts/${ postId } /remove ` , null , { timeout } )
104105 . then ( resp => {
105106 return {
106107 result : _ . get ( resp . data , 'result.content' , { } )
0 commit comments