forgeplus-react/src/service/forums.ts

106 lines
2.2 KiB
TypeScript

import Fetch from '@/utils/fetch';
export async function getForumsData(params: any) {
return Fetch(`/api/memos.json`, {
method: 'get',
params,
});
}
export async function getForumsShixunData(params: any) {
return Fetch(`/api/discusses/forum_discusses.json`, {
method: 'get',
params,
});
}
export async function stickyOrCancel(params: any) {
return Fetch(`/api/memos/${params.id}/sticky_or_cancel.json`, {
method: 'post',
body: params,
});
}
export async function deleteForums(params: any) {
return Fetch(`/api/memos/${params.id}.json`, {
method: 'delete',
body: params,
})
}
export async function getForumsNewData(params: any) {
return Fetch(`/api/memos/new.json`, {
method: 'get',
params,
});
}
export async function getForumsEditData(params: any) {
return Fetch(`/api/memos/${params.id}/edit.json`, {
method: 'get',
params,
});
}
export async function newForums(params: any) {
return Fetch(`/api/memos.json`, {
method: 'post',
body: { ...params },
});
}
export async function updateForums(params: any) {
return Fetch(`/api/memos/${params.id}.json`, {
method: 'put',
body: { ...params }
});
}
export async function getForumsDetailData(params: any) {
return Fetch(`/api/memos/${params.id}.json`, {
method: 'get',
params,
});
}
export async function watch(params: any) {
return Fetch(`/api/users/${params.user_id}/watch.json`, {
method: 'post',
body: params,
})
}
export async function cancelWatch(params: any) {
return Fetch(`/api/users/${params.user_id}/watch.json`, {
method: 'delete',
body: { ...params }
});
}
export async function rewardCode(params: any) {
return Fetch(`/api/discusses/${params.id}/reward_code.json`, {
method: 'post',
body: params,
})
}
export async function like(params: any) {
return Fetch(`/api/discusses/${params.id}/plus.json`, {
method: 'post',
body: params,
})
}
export async function reply(params: any) {
return Fetch(`/api/memos/reply.json`, {
method: 'post',
body: params,
})
}
export async function getMoreReply(params: any) {
return Fetch(`/api/memos/${params.id}/more_reply.json`, {
method: 'get',
params,
});
}