mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix source formatting
This commit is contained in:
@@ -22,25 +22,22 @@
|
||||
window.VERCEL_ANALYTICS_ID = import.meta.env.VERCEL_ANALYTICS_ID?.toString() ?? false;
|
||||
}
|
||||
|
||||
// Format source array to count source occurrences
|
||||
let format = (arr) => {
|
||||
const counts = {}; // Object to store the counts
|
||||
const counts = {};
|
||||
|
||||
// Loop through each item in the array
|
||||
arr.forEach((item) => {
|
||||
// Increment the count for each key in the object
|
||||
counts[item] = (counts[item] || 0) + 1;
|
||||
const key = item.split(';')[0];
|
||||
counts[key] = (counts[key] || 0) + 1;
|
||||
});
|
||||
|
||||
// Convert counts object into the required string format array
|
||||
const formattedArray = Object.entries(counts).map(([key, value]) => `${key},${value}`);
|
||||
|
||||
return formattedArray;
|
||||
return Object.entries(counts).map(([key, count]) => `${key};${count}`);
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
// handle sources
|
||||
if (browser) {
|
||||
const source = Cookies.get('source');
|
||||
console.log(source);
|
||||
let sources = source ? decodeURIComponent(source).split(',') : [];
|
||||
console.log(sources);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user