mirror of
https://github.com/jorisbertomeu/web-screensaver.git
synced 2026-04-19 16:27:40 +02:00
Fix relative to unsplash service
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
import { generatePictureFilename } from '../utils/helper.js';
|
import { generatePictureFilename } from '../utils/helper.js';
|
||||||
|
import { UnsplashService } from './UnsplashService.js';
|
||||||
|
|
||||||
export class PhotoService {
|
export class PhotoService {
|
||||||
constructor(fileService, unsplashService) {
|
constructor(fileService) {
|
||||||
this.fileService = fileService;
|
this.fileService = fileService;
|
||||||
this.unsplashService = unsplashService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async pickPictureFromFile(collections = [], burnPic = true) {
|
async pickPictureFromFile(collections = [], burnPic = true) {
|
||||||
@@ -22,9 +22,10 @@ export class PhotoService {
|
|||||||
|
|
||||||
return pic;
|
return pic;
|
||||||
}
|
}
|
||||||
|
const newPics = await UnsplashService.getRandomPhotos(collections);
|
||||||
const newPics = await this.unsplashService.getRandomPhotos(collections);
|
if (newPics.length === 0) {
|
||||||
if (newPics.length === 0) return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
this.fileService.writeJsonFile(filename, newPics);
|
this.fileService.writeJsonFile(filename, newPics);
|
||||||
return newPics[0];
|
return newPics[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user