diff --git a/src/stores/AuthStore.js b/src/stores/AuthStore.js
index fce5851..24943ee 100644
--- a/src/stores/AuthStore.js
+++ b/src/stores/AuthStore.js
@@ -3,8 +3,10 @@ import { devtools } from 'zustand/middleware'
import { fetchJSON } from '@/utils/request'
import { isEmpty, isNotEmpty } from '@/utils/commons'
import { API_HOST, BUILD_VERSION } from '@/config'
+
export const PERM_MERGE_CONVERSATION = 'merge-conversation'
export const PERM_ASSIGN_NEW_CONVERSATION = 'assign-new-conversation'
+export const PERM_USE_EMAL = 'use-email'
const useAuthStore = create(devtools((set, get) => ({
loginUser: {
@@ -24,6 +26,10 @@ const useAuthStore = create(devtools((set, get) => ({
isPermitted: (perm) => {
const { loginUser } = get()
+ if (perm === PERM_USE_EMAL) {
+ return ['599', '495', '143', '370', '639', '513', '654', '404', '383', '227'].includes(loginUser.userId)
+ }
+
if (perm === PERM_MERGE_CONVERSATION) {
return ['404', '383', '227'].includes(loginUser.userId)
}
@@ -74,7 +80,7 @@ const useAuthStore = create(devtools((set, get) => ({
backup: item.Isbakemail == 1,
}
}),
- // whatsAppBusiness: json.result.opicode,
+ whatsAppBusiness: json.result.whatsappinfo.length > 0 ? json.result.whatsappinfo[0].whatsapp_waba : '',
accountName: json.result.opicode,
username: json.result.nick,
avatarUrl: json.result.avatarUrl,
diff --git a/src/stores/OrderStore.js b/src/stores/OrderStore.js
index d3ba617..009752e 100644
--- a/src/stores/OrderStore.js
+++ b/src/stores/OrderStore.js
@@ -132,7 +132,7 @@ export const useOrderStore = create(devtools((set, get) => ({
return fetchJSON(`${API_HOST}/generate_email_msg`, { coli_sn: orderId, coli_id: orderNumber })
.then(json => {
if (json.errcode === 0) {
- console.info(json)
+ return json
} else {
throw new Error(json?.errmsg + ': ' + json.errcode)
}
diff --git a/src/views/AuthApp.jsx b/src/views/AuthApp.jsx
index d1e6ed2..003c120 100644
--- a/src/views/AuthApp.jsx
+++ b/src/views/AuthApp.jsx
@@ -1,7 +1,9 @@
import ErrorBoundary from '@/components/ErrorBoundary'
import useAuthStore from '@/stores/AuthStore'
-import useConversationStore from '@/stores/ConversationStore'
import { useThemeContext } from '@/stores/ThemeContext'
+import { Conditional } from '@/components/Conditional'
+import useConversationStore from '@/stores/ConversationStore'
+import { PERM_USE_EMAL } from '@/stores/AuthStore'
import {
App as AntApp,
ConfigProvider,
@@ -31,7 +33,9 @@ function AuthApp() {
const [messageApi, contextHolder] = message.useMessage()
const { colorPrimary, borderRadius } = useThemeContext()
- const [loginUser, sendNotify] = useAuthStore((state) => [state.loginUser, state.sendNotify])
+ const [loginUser, sendNotify, isPermitted] = useAuthStore((state) => [
+ state.loginUser, state.sendNotify, state.isPermitted
+ ])
const href = useHref()
@@ -53,7 +57,8 @@ function AuthApp() {
loadPageSpy(loginUser.username)
connectWebsocket(loginUser.userId)
fetchInitialData(loginUser)
- startEmailInterval(loginUser.userId)
+
+ if (isPermitted(PERM_USE_EMAL)) startEmailInterval(loginUser.userId)
}
return () => {
disconnectWebsocket()
@@ -63,7 +68,7 @@ function AuthApp() {
const startEmailInterval = (userId) => {
setInterval(() => {
getEmailFetchAction({opi_sn: userId})
- }, 1000*60)
+ }, 1000*10)
}
const uploadLog = () => {
@@ -109,7 +114,10 @@ function AuthApp() {
insetInlineEnd: 94,
}}
>
-