Browse Source

feat: comment avatar update

master
OhYee 2 years ago
parent
commit
f6f843ba43
Signed by: OhYee
GPG Key ID: 5A9E1F63ED274FBB
  1. 17
      pages/admin/comments.tsx
  2. 6
      utils/api.ts

17
pages/admin/comments.tsx

@ -12,7 +12,7 @@ import { Flex } from '@/components/container'; @@ -12,7 +12,7 @@ import { Flex } from '@/components/container';
import Loading from '@/components/loading';
import { Context } from '@/utils/global';
import { commentDelete, commentsAdmin, commentSet } from '@/utils/api';
import { commentDelete, commentsAdmin, commentSet, commentsAvatar } from '@/utils/api';
import moment from '@/utils/moment';
import ShowNotification from '@/utils/notification';
@ -133,7 +133,20 @@ class AdminComments extends React.Component<AdminCommentsProps, AdminCommentsSta @@ -133,7 +133,20 @@ class AdminComments extends React.Component<AdminCommentsProps, AdminCommentsSta
</Head>
<Flex fullWidth direction="TB">
<p> {this.state.total} </p>
<Flex direction="LR">
<p> {this.state.total} </p>
<Button
neumorphism
loading={this.state.loading}
onClick={async () => {
this.setState({ loading: true });
ShowNotification(await commentsAvatar());
this.setState({ loading: false });
}}
>
</Button>
</Flex>
<Loading loading={this.state.loading}>
{this.state.data.map((comment, idx) => (
<Flex key={comment.id} mainAxis="space-between" wrap={!context.big_screen}>

6
utils/api.ts

@ -360,6 +360,12 @@ export const commentDelete = async ( @@ -360,6 +360,12 @@ export const commentDelete = async (
return await request('get', `/api/admin/comment/delete`, { id }, callback);
};
export const commentsAvatar = async (
callback?: RequestCallback<Blotter.APIResponse>,
) => {
return await request('get', `/api/admin/comments/avatar`, {}, callback);
};
export const userSet = async (
username: string,
email: string,

Loading…
Cancel
Save