You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/05/20 12:11:31 UTC
[incubator-apisix-dashboard] 01/02: feat: added API.d.ts
This is an automated email from the ASF dual-hosted git repository.
juzhiyuan pushed a commit to branch feat-access
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git
commit 9a0615382d8d028792ca9f6f44676a178fa5115d
Author: juzhiyuan <jj...@gmail.com>
AuthorDate: Wed May 20 16:49:38 2020 +0800
feat: added API.d.ts
---
src/access.ts | 6 ++++++
src/services/API.d.ts | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/src/access.ts b/src/access.ts
new file mode 100644
index 0000000..207bc4b
--- /dev/null
+++ b/src/access.ts
@@ -0,0 +1,6 @@
+export default function (initialState: { currentUser?: API.CurrentUser | undefined }) {
+ const { currentUser } = initialState || {};
+ return {
+ canAdmin: currentUser && currentUser.access === 'admin',
+ };
+}
diff --git a/src/services/API.d.ts b/src/services/API.d.ts
new file mode 100644
index 0000000..63cabec
--- /dev/null
+++ b/src/services/API.d.ts
@@ -0,0 +1,35 @@
+declare namespace API {
+ export interface CurrentUser {
+ avatar?: string;
+ name?: string;
+ title?: string;
+ group?: string;
+ signature?: string;
+ tags?: {
+ key: string;
+ label: string;
+ }[];
+ userid?: string;
+ access?: 'user' | 'guest' | 'admin';
+ unreadCount?: number;
+ }
+
+ export interface LoginStateType {
+ status?: 'ok' | 'error';
+ type?: string;
+ }
+
+ export interface NoticeIconData {
+ id: string;
+ key: string;
+ avatar: string;
+ title: string;
+ datetime: string;
+ type: string;
+ read?: boolean;
+ description: string;
+ clickClose?: boolean;
+ extra: any;
+ status: string;
+ }
+}