chore: normalize formatting
This commit is contained in:
parent
01ed2ac3b3
commit
2f6cfbe7ae
61 changed files with 921 additions and 743 deletions
|
@ -1,40 +1,40 @@
|
|||
import { createClient } from '@supabase/supabase-js'
|
||||
import { createClient } from "@supabase/supabase-js";
|
||||
|
||||
const SUPABASE_URL = process.env.SUPABASE_URL
|
||||
const SUPABASE_KEY = process.env.SUPABASE_KEY
|
||||
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
|
||||
const PAGE_SIZE = 1000
|
||||
const SUPABASE_URL = process.env.SUPABASE_URL;
|
||||
const SUPABASE_KEY = process.env.SUPABASE_KEY;
|
||||
const supabase = createClient(SUPABASE_URL, SUPABASE_KEY);
|
||||
const PAGE_SIZE = 1000;
|
||||
|
||||
const fetchAllLinks = async () => {
|
||||
let links = []
|
||||
let page = 0
|
||||
let fetchMore = true
|
||||
let links = [];
|
||||
let page = 0;
|
||||
let fetchMore = true;
|
||||
|
||||
while (fetchMore) {
|
||||
const { data, error } = await supabase
|
||||
.from('optimized_links')
|
||||
.select('*')
|
||||
.range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1)
|
||||
.from("optimized_links")
|
||||
.select("*")
|
||||
.range(page * PAGE_SIZE, (page + 1) * PAGE_SIZE - 1);
|
||||
|
||||
if (error) {
|
||||
console.error('Error fetching links:', error)
|
||||
return links
|
||||
console.error("Error fetching links:", error);
|
||||
return links;
|
||||
}
|
||||
|
||||
if (data.length < PAGE_SIZE) fetchMore = false
|
||||
if (data.length < PAGE_SIZE) fetchMore = false;
|
||||
|
||||
links = links.concat(data)
|
||||
page++
|
||||
links = links.concat(data);
|
||||
page++;
|
||||
}
|
||||
|
||||
return links
|
||||
}
|
||||
return links;
|
||||
};
|
||||
|
||||
export default async function () {
|
||||
try {
|
||||
return await fetchAllLinks()
|
||||
return await fetchAllLinks();
|
||||
} catch (error) {
|
||||
console.error('Error fetching and processing links:', error)
|
||||
return []
|
||||
console.error("Error fetching and processing links:", error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue