refactor code
This commit is contained in:
parent
e13c9e6d42
commit
3ccd3af1aa
@ -120,7 +120,6 @@ export const oauthState = writable(<string>"");
|
||||
export const oauthVerifier = writable(<string>"");
|
||||
export const oauthProvider = writable(<string>"");
|
||||
|
||||
export const switchWatchList = writable(<boolean>false);
|
||||
|
||||
export const cachedPosts = writable(<Array<any>>{});
|
||||
export const currentPagePosition = writable(<Number>0);
|
||||
|
||||
@ -1,31 +1,5 @@
|
||||
export const load = async ({ locals }) => {
|
||||
/*
|
||||
const getMiniPlotsIndex = async () => {
|
||||
let output;
|
||||
|
||||
// Get cached data for the specific tickerID
|
||||
const cachedData = getCache('', 'getMiniPlotsIndex');
|
||||
if (cachedData) {
|
||||
output = cachedData;
|
||||
} else {
|
||||
const {apiKey, apiURL} = await parent();
|
||||
|
||||
// make the POST request to the endpoint
|
||||
const response = await fetch(apiURL + '/mini-plots-index', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json", "X-API-KEY": apiKey
|
||||
},
|
||||
});
|
||||
|
||||
output = await response.json();
|
||||
|
||||
setCache('', output, 'getMiniPlotsIndex');
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
const getAllWatchlist = async () => {
|
||||
const { pb, user } = locals;
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
searchBarData,
|
||||
screenWidth,
|
||||
numberOfUnreadNotification,
|
||||
switchWatchList,
|
||||
} from "$lib/store";
|
||||
import { formatDate, abbreviateNumber } from "$lib/utils";
|
||||
import toast from "svelte-french-toast";
|
||||
@ -17,6 +16,7 @@
|
||||
export let data;
|
||||
|
||||
let searchQuery = "";
|
||||
let switchWatchlist = false;
|
||||
let editMode = false;
|
||||
let numberOfChecked = 0;
|
||||
let deleteTickerList = [];
|
||||
@ -425,7 +425,7 @@
|
||||
|
||||
function changeWatchList(newWatchList) {
|
||||
displayWatchList = newWatchList;
|
||||
$switchWatchList = true;
|
||||
switchWatchlist = true;
|
||||
}
|
||||
|
||||
function saveRules() {
|
||||
@ -502,10 +502,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
$switchWatchList = false;
|
||||
});
|
||||
|
||||
function handleWatchlistModal() {
|
||||
const closePopup = document.getElementById("addWatchlist");
|
||||
closePopup?.dispatchEvent(new MouseEvent("click"));
|
||||
@ -579,11 +575,11 @@
|
||||
$: charNumber = $screenWidth < 640 ? 15 : 20;
|
||||
|
||||
$: {
|
||||
if ($switchWatchList && typeof window !== "undefined") {
|
||||
if (switchWatchlist && typeof window !== "undefined") {
|
||||
isLoaded = false;
|
||||
getWatchlistData();
|
||||
isLoaded = true;
|
||||
$switchWatchList = false;
|
||||
switchWatchlist = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user