mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-21 04:01:41 +10:00
feat(all): upgrade to v3.4.0
This commit is contained in:
22037
server/src/fonts/assets/cachedResponse.json
Normal file
22037
server/src/fonts/assets/cachedResponse.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,8 @@ import { Font } from '@reactive-resume/schema';
|
||||
import { get } from 'lodash';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
|
||||
import cachedResponse from './assets/cachedResponse.json';
|
||||
|
||||
@Injectable()
|
||||
export class FontsService {
|
||||
constructor(private configService: ConfigService, private httpService: HttpService) {}
|
||||
@ -13,8 +15,14 @@ export class FontsService {
|
||||
const apiKey = this.configService.get<string>('google.apiKey');
|
||||
const url = 'https://www.googleapis.com/webfonts/v1/webfonts?key=' + apiKey;
|
||||
|
||||
const response = await firstValueFrom(this.httpService.get(url));
|
||||
const data = get(response.data, 'items', []);
|
||||
let data = [];
|
||||
|
||||
if (apiKey) {
|
||||
const response = await firstValueFrom(this.httpService.get(url));
|
||||
data = get(response.data, 'items', []);
|
||||
} else {
|
||||
data = cachedResponse;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user