Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit d54c6f3

Browse files
committed
Add block and unblock
1 parent 59b72e0 commit d54c6f3

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

src/api/block.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import agent from '../structures/agent'
2+
3+
const block = async (profile, user) => {
4+
'use strict'
5+
6+
const response = await agent(
7+
'/block',
8+
{
9+
body: {
10+
user_id: user || -1
11+
}
12+
},
13+
profile
14+
)
15+
const data = await response.json()
16+
17+
return data
18+
}
19+
20+
export default block
21+
22+
export const specification = {
23+
success: Boolean
24+
}

src/api/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ import getChannel from './getChannel'
5252
import getNotifications from './getNotifications'
5353
import getActionableNotifications from './getActionableNotifications'
5454
import requestMobileAuthAgain from './requestMobileAuthAgain'
55+
import block from './block'
56+
import unblock from './unblock'
5557

5658
// NOTE: Externals
5759
import getStatic from './getStatic'
@@ -111,5 +113,7 @@ export {
111113
getChannel,
112114
getNotifications,
113115
getActionableNotifications,
114-
requestMobileAuthAgain
116+
requestMobileAuthAgain,
117+
block,
118+
unblock
115119
}

src/api/unblock.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import agent from '../structures/agent'
2+
3+
const unblock = async (profile, user) => {
4+
'use strict'
5+
6+
const response = await agent(
7+
'/unblock',
8+
{
9+
body: {
10+
user_id: user || -1
11+
}
12+
},
13+
profile
14+
)
15+
const data = await response.json()
16+
17+
return data
18+
}
19+
20+
export default unblock
21+
22+
export const specification = {
23+
success: Boolean
24+
}

0 commit comments

Comments
 (0)