clean up
This commit is contained in:
@@ -6,9 +6,9 @@
|
|||||||
export interface Quote {
|
export interface Quote {
|
||||||
text: string;
|
text: string;
|
||||||
author: string;
|
author: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const businessQuotes: Quote[] = [
|
export const businessQuotes: Quote[] = [
|
||||||
// Steve Jobs quotes
|
// Steve Jobs quotes
|
||||||
{ text: "Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work.", author: "Steve Jobs" },
|
{ text: "Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work.", author: "Steve Jobs" },
|
||||||
{ text: "Innovation distinguishes between a leader and a follower.", author: "Steve Jobs" },
|
{ text: "Innovation distinguishes between a leader and a follower.", author: "Steve Jobs" },
|
||||||
@@ -50,21 +50,25 @@ export interface Quote {
|
|||||||
{ text: "If you want to achieve greatness stop asking for permission.", author: "Anonymous" },
|
{ text: "If you want to achieve greatness stop asking for permission.", author: "Anonymous" },
|
||||||
{ text: "Things work out best for those who make the best of how things work out.", author: "John Wooden" },
|
{ text: "Things work out best for those who make the best of how things work out.", author: "John Wooden" },
|
||||||
{ text: "The most valuable businesses of coming decades will be built by entrepreneurs who seek to empower people rather than try to make them obsolete.", author: "Peter Thiel" },
|
{ text: "The most valuable businesses of coming decades will be built by entrepreneurs who seek to empower people rather than try to make them obsolete.", author: "Peter Thiel" },
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
// For backward compatibility with existing code
|
||||||
|
export const quotes = businessQuotes;
|
||||||
|
export default businessQuotes;
|
||||||
|
|
||||||
|
/**
|
||||||
* Returns a random business quote from the collection
|
* Returns a random business quote from the collection
|
||||||
*/
|
*/
|
||||||
export function getRandomQuote(): Quote {
|
export function getRandomQuote(): Quote {
|
||||||
const randomIndex = Math.floor(Math.random() * businessQuotes.length);
|
const randomIndex = Math.floor(Math.random() * businessQuotes.length);
|
||||||
return businessQuotes[randomIndex];
|
return businessQuotes[randomIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a random quote by a specific author if available,
|
* Returns a random quote by a specific author if available,
|
||||||
* otherwise returns a random quote from any author
|
* otherwise returns a random quote from any author
|
||||||
*/
|
*/
|
||||||
export function getRandomQuoteByAuthor(author: string): Quote {
|
export function getRandomQuoteByAuthor(author: string): Quote {
|
||||||
const authorQuotes = businessQuotes.filter(quote =>
|
const authorQuotes = businessQuotes.filter(quote =>
|
||||||
quote.author.toLowerCase() === author.toLowerCase()
|
quote.author.toLowerCase() === author.toLowerCase()
|
||||||
);
|
);
|
||||||
@@ -75,13 +79,13 @@ export interface Quote {
|
|||||||
|
|
||||||
const randomIndex = Math.floor(Math.random() * authorQuotes.length);
|
const randomIndex = Math.floor(Math.random() * authorQuotes.length);
|
||||||
return authorQuotes[randomIndex];
|
return authorQuotes[randomIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns quotes filtered by a theme or keyword in the text
|
* Returns quotes filtered by a theme or keyword in the text
|
||||||
*/
|
*/
|
||||||
export function getQuotesByTheme(keyword: string): Quote[] {
|
export function getQuotesByTheme(keyword: string): Quote[] {
|
||||||
return businessQuotes.filter(quote =>
|
return businessQuotes.filter(quote =>
|
||||||
quote.text.toLowerCase().includes(keyword.toLowerCase())
|
quote.text.toLowerCase().includes(keyword.toLowerCase())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -55,8 +55,6 @@ export async function clientFetch<T = any>(url: string, options: RequestInit = {
|
|||||||
// Normalize URL to ensure it uses the Next.js API proxy
|
// Normalize URL to ensure it uses the Next.js API proxy
|
||||||
const fullUrl = normalizeApiUrl(url);
|
const fullUrl = normalizeApiUrl(url);
|
||||||
|
|
||||||
console.log(`Fetching URL: ${fullUrl}`);
|
|
||||||
|
|
||||||
const res = await fetch(fullUrl, {
|
const res = await fetch(fullUrl, {
|
||||||
...options,
|
...options,
|
||||||
headers,
|
headers,
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ export async function fetchServer<T = unknown>(
|
|||||||
// Get the complete backend URL using the utility function
|
// Get the complete backend URL using the utility function
|
||||||
const url = getServerApiUrl(endpoint);
|
const url = getServerApiUrl(endpoint);
|
||||||
|
|
||||||
console.log(`Making server request to: ${url}`);
|
|
||||||
|
|
||||||
// Make the request with proper auth headers
|
// Make the request with proper auth headers
|
||||||
const res = await fetch(url, {
|
const res = await fetch(url, {
|
||||||
...options,
|
...options,
|
||||||
|
|||||||
Reference in New Issue
Block a user