improve banner image Merge branch 'main' of https://gitlab.com/thenextgreat/classroomio into CLASSROOMIO-T-177 Merge branch 'CLASSROOMIO-T-177' of https://gitlab.com/thenextgreat/classroomio into CLASSROOMIO-T-177 CLASSROOMIO-T-177: Moved API call to backend general ux improvements Merge branch 'CLASSROOMIO-T-177' of https://gitlab.com/thenextgreat/classroomio into CLASSROOMIO-T-177 CLASSROOMIO-T-177: Resolved Feedbacks CLASSROOMIO-T-177: UI improvements CLASSROOMIO-T-177: fix styling or image CLASSROOMIO-T-177: Resolved Feedbacks CLASSROOMIO-T-177: Landing Page Max Width CLASSROOMIO-T-177: Refactor Upload Widget Merge branch 'main' into CLASSROOMIO-T-177 CLASSROOMIO-T-177: Completion of Upload Widget Merge branch 'main' into CLASSROOMIO-T-177 CLASSROOMIO-T-177: Widget Test Co-authored-by: Rotimi Best <[email protected]> Co-authored-by: Tunji Adeyemi <[email protected]> Merge-request: CLASSROOMIO-MR-86 Merged-by: Best Admin <[email protected]>
24 lines
693 B
TypeScript
24 lines
693 B
TypeScript
import { supabase } from '$lib/utils/functions/supabase';
|
|
|
|
export async function queryUnsplash(searchQuery: string) {
|
|
const { data } = await supabase.auth.getSession();
|
|
const accessToken = data.session?.access_token || '';
|
|
|
|
try {
|
|
const response = await fetch('/api/unsplash', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
Authorization: accessToken
|
|
},
|
|
body: JSON.stringify({ searchQuery })
|
|
});
|
|
if (!response.ok) {
|
|
throw new Error(await response.text());
|
|
}
|
|
const result = await response.json();
|
|
return result.photos;
|
|
} catch (error) {
|
|
console.error('Error sending fetch request', error);
|
|
}
|
|
} |