Changeset 8496f3c for src/lib


Ignore:
Timestamp:
09/15/26 21:16:02 (8 days ago)
Author:
Stefan-Saveski <stefansaveski19@…>
Branches:
master
Children:
b8093a0
Parents:
4fe4582
Message:
  • ready for presentation
Location:
src/lib
Files:
2 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • src/lib/auth.ts

    r4fe4582 r8496f3c  
     1import { API_BASE_URL } from './api';
    12export type AuthTokens = {
    23  accessToken: string;
     
    45};
    56
    6 export type UserRole = 'Professor' | 'Student' | string;
     7export type UserRole = 'Professor' | 'Student' | 'Admin' | string;
    78
    89export type AuthSession = AuthTokens & {
     
    9192
    9293export async function login(params: { email: string; password: string }): Promise<AuthSession> {
    93   const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL ?? 'https://iknow-api.onrender.com';
     94  const baseUrl = API_BASE_URL;
    9495
    9596  const response = await fetch(`${baseUrl}/api/auth/login`, {
  • src/lib/pdf-generators.ts

    r4fe4582 r8496f3c  
    22import autoTable from 'jspdf-autotable';
    33import { loadCyrillicFonts } from './pdf-fonts';
     4import { apiUrl } from './api';
    45
    56/* ---------- shared types ---------- */
     
    10561057): Promise<void> {
    10571058  // Fetch student profile
    1058   const profileRes = await fetch('https://iknow-api.onrender.com/api/user/getUser', {
     1059  const profileRes = await fetch(apiUrl('/api/user/getUser'), {
    10591060    headers: { Authorization: `Bearer ${accessToken}` },
    10601061  });
     
    10951096  let passedExams: PassedExam[] = [];
    10961097  if (needsExams) {
    1097     const examsRes = await fetch('https://iknow-api.onrender.com/api/user/getPassedSubjects', {
     1098    const examsRes = await fetch(apiUrl('/api/user/getPassedSubjects'), {
    10981099      headers: { Authorization: `Bearer ${accessToken}` },
    10991100    });
Note: See TracChangeset for help on using the changeset viewer.