sonar qube; getCookie refactored

This commit is contained in:
Cindy Chang
2024-07-16 15:18:31 +08:00
parent fd5b65a3b6
commit 6a689e419c
3 changed files with 10 additions and 17 deletions

View File

@@ -1,18 +1,17 @@
export function getCookie(name) { export function getCookie(name) {
const nameEqual = name + "="; const nameEqual = name + "=";
const cookieArr = document.cookie.split(';'); const cookieArr = document.cookie.split(';');
for (let i = 0; i < cookieArr.length; i++) {
let c = cookieArr[i]; for (const cookie of cookieArr) {
while (c.charAt(0) === ' ') { let c = cookie.trim();
c = c.substring(1, c.length); if (c.indexOf(nameEqual) === 0) {
return c.substring(nameEqual.length, c.length);
} }
if (c.indexOf(nameEqual) === 0) {
return c.substring(nameEqual.length, c.length);
}
}
return null;
} }
return null;
}
export function setCookie(name, value, days=1) { export function setCookie(name, value, days=1) {
let expires = ""; let expires = "";
if (days) { if (days) {

View File

@@ -426,7 +426,6 @@ export default {
this.isLoading = true; this.isLoading = true;
this.infiniteFinish = false; this.infiniteFinish = false;
this.infiniteStart += ONCE_RENDER_NUM_OF_DATA; this.infiniteStart += ONCE_RENDER_NUM_OF_DATA;
// await this.acctMgmtStore.getAccountDetail();
this.infiniteAcctDataVue2 = await [...this.infiniteAcctDataVue2, ...this.allUserAccoutList.slice( this.infiniteAcctDataVue2 = await [...this.infiniteAcctDataVue2, ...this.allUserAccoutList.slice(
this.infiniteStart, this.infiniteStart + ONCE_RENDER_NUM_OF_DATA)]; this.infiniteStart, this.infiniteStart + ONCE_RENDER_NUM_OF_DATA)];
this.isInfiniteFinish = true; this.isInfiniteFinish = true;
@@ -452,9 +451,6 @@ export default {
}, },
created() { created() {
}, },
mounted() {
this.isLoading = false; //TODO:
},
}; };
</script> </script>
<style> <style>

View File

@@ -42,8 +42,6 @@ export default {
name, name,
is_admin, is_admin,
is_active, is_active,
is_sso,
has_data,
} = currentViewingUser.value; } = currentViewingUser.value;
onBeforeMount(async() => { onBeforeMount(async() => {