forked from aboutmydreams/aiis.read
-
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.
- Loading branch information
1 parent
ecc10b6
commit d2a59ca
Showing
11 changed files
with
185 additions
and
45 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,25 @@ | ||
interface Community { | ||
subject: string; | ||
ownerUser: UserInfo; | ||
ownerUser: { | ||
address: string; | ||
avatar: string; | ||
twitterId: string; | ||
username: string; | ||
}; | ||
stakedShares: string; | ||
requiredStakedShares: string; | ||
// 0=locked, 1=unlocked | ||
status: 0 | 1; | ||
} | ||
|
||
interface CommunityUserInfo { | ||
twitterId: string; | ||
username: string; | ||
avatar: string; | ||
address: string; | ||
shares: string; | ||
stakedShares: string; | ||
isBlocked: boolean; | ||
allowChat: boolean; | ||
communityUnlocked: boolean; | ||
} |
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 |
---|---|---|
@@ -1,8 +1,48 @@ | ||
import http, { ResultData } from '../request'; | ||
|
||
// 获取社区列表 | ||
export async function getList(status: 0 | 1) { | ||
const response = await http.get<ResultData<ItemsResponse<Community>>>('/api/community/mine', { | ||
status, | ||
}); | ||
return response.data.items; | ||
} | ||
|
||
// 获取我在这个 subject 社区里的用户信息 | ||
export async function getMyInfo(subject: string) { | ||
const response = await http.get<ResultData<CommunityUserInfo>>('/api/community/user/me', { | ||
subject, | ||
}); | ||
return response.data; | ||
} | ||
|
||
export async function getUserList(subject: string) { | ||
const response = await http.get<ResultData<ItemsResponse<CommunityUserInfo>>>( | ||
'/api/community/users', | ||
{ | ||
subject, | ||
} | ||
); | ||
return response.data.items; | ||
} | ||
|
||
export async function getUserCount(subject: string) { | ||
const response = await http.get<ResultData<ItemsResponse<CommunityUserInfo>>>( | ||
'/api/community/users', | ||
{ | ||
subject, | ||
limit: 0, | ||
} | ||
); | ||
return response.data.total; | ||
} | ||
|
||
// 封禁/解封指定社区的用户 | ||
export async function blockUser(ownerAddress: string, userAddress: string, isBlocked: boolean) { | ||
const response = await http.post<ResultData<null>>('/api/community/user/block', { | ||
ownerAddress, | ||
userAddress, | ||
isBlocked, | ||
}); | ||
return response.data; | ||
} |
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
Oops, something went wrong.