Skip to content

Commit 318ed73

Browse files
committed
feat: remove code
1 parent 4693f28 commit 318ed73

File tree

3 files changed

+12
-31
lines changed

3 files changed

+12
-31
lines changed

.eslintrc.json

+2-10
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
"no-multiple-empty-lines": "off",
129129
"no-new-wrappers": "error",
130130
"no-lonely-if": "off",
131+
"no-param-reassign":"off",
131132
"no-shadow": [
132133
"off",
133134
{
@@ -163,6 +164,7 @@
163164
"spaced-comment": ["error", "always", { "markers": ["/"] }],
164165
"use-isnan": "error",
165166
"valid-typeof": "off",
167+
"prefer-destructuring":"off",
166168
"react/jsx-no-target-blank": [
167169
"error",
168170
{
@@ -234,16 +236,6 @@
234236
},
235237
"ecmaVersion": 12,
236238
"sourceType": "module"
237-
},
238-
"rules": {
239-
"@typescript-eslint/explicit-module-boundary-types": ["error"]
240-
}
241-
},
242-
{
243-
// enable the rule specifically for TypeScript files
244-
"files": ["*.js", "*.ts"],
245-
"rules": {
246-
"@typescript-eslint/explicit-module-boundary-types": ["error"]
247239
}
248240
}
249241
]

src/client/library/apis.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ for (const key of Object.keys(serverMap)) {
4141

4242
createInstance.useReq((config: any) => {
4343
let token = getToken()
44-
const dToken = parseQuery('FC_SESSION')
44+
const dToken = parseQuery('SESSION')
4545
if (dToken) {
4646
token = dToken
4747
setCookie(getTokenKey(), dToken)

src/client/library/utils.ts

+9-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import env from '@/config/env'
2-
31
export function getCookie(name: string): string | null {
4-
const cookieName = encodeURIComponent(name) + '='
2+
const cookieName = `${encodeURIComponent(name)}=`
53
const cookieStart = document.cookie.indexOf(cookieName)
64
let cookieValue = null
75

@@ -25,18 +23,18 @@ export function setCookie(
2523
domain?: string,
2624
secure?: boolean
2725
): void {
28-
let cookieText = encodeURIComponent(name) + '=' + encodeURIComponent(value)
26+
let cookieText = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`
2927

3028
if (expires instanceof Date) {
31-
cookieText += '; expires=' + expires.toUTCString()
29+
cookieText += `; expires=${expires.toUTCString()}`
3230
}
3331

3432
if (path) {
35-
cookieText += '; path=' + path
33+
cookieText += `; path=${path}`
3634
}
3735

3836
if (domain) {
39-
cookieText += '; domain=' + domain
37+
cookieText += `; domain=${domain}`
4038
}
4139

4240
if (secure) {
@@ -61,15 +59,15 @@ export function unsetCookie(
6159
})
6260
paths.forEach(p => {
6361
setCookie(name, '', new Date(0), p, domain, secure)
64-
setCookie(name, '', new Date(0), p, `.` + domain, secure)
62+
setCookie(name, '', new Date(0), p, `.${domain}`, secure)
6563
})
6664
}
6765

6866
export function base64Decode(str: string): string {
6967
str = window
7068
.atob(str)
7169
.split('')
72-
.map((c: string) => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2))
70+
.map((c: string) => `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`)
7371
.join('')
7472
return decodeURIComponent(str)
7573
}
@@ -81,7 +79,7 @@ export function compose(f: (...args: any[]) => any, g: (...args: any[]) => any)
8179
}
8280

8381
export function getTokenKey(): string {
84-
const key = 'FC_SESSION'
82+
const key = 'SESSION'
8583
return key
8684
}
8785

@@ -143,18 +141,9 @@ export const to = (promise: any) => {
143141
}).catch(err => [err, null])
144142
}
145143
return promise
146-
.then((...args: any[]) => [null,...args])
144+
.then((...args: any[]) => [null, ...args])
147145
.catch((err: any) => [err, null])
148146
}
149147

150148
export const isValidArray = (list: any): boolean =>
151149
Boolean(list) && Array.isArray(list) && Boolean(list.length)
152-
153-
// 获取前端路由
154-
export const getFrontHost = () => {
155-
if (env.ENV === 'prod') {
156-
return `${window.ENV_DOMAIN.split(',')[1]}/#`
157-
} else {
158-
return `${window.ENV_DOMAIN}/${window.CI_PROJECT_NAMESPACE}/${window.CI_APP_NAME}/#`
159-
}
160-
}

0 commit comments

Comments
 (0)