2018-05-26 20:49:55 -04:00
|
|
|
import {Injectable} from '@angular/core';
|
|
|
|
import {ShareService} from '../gallery/share.service';
|
|
|
|
import {PhotoDTO} from '../../../common/entities/PhotoDTO';
|
2018-11-04 19:28:32 +01:00
|
|
|
import {MediaDTO} from '../../../common/entities/MediaDTO';
|
2018-11-30 15:36:42 +01:00
|
|
|
import {QueryParams} from '../../../common/QueryParams';
|
2018-05-26 20:49:55 -04:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class QueryService {
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private shareService: ShareService) {
|
|
|
|
}
|
|
|
|
|
2018-11-04 19:28:32 +01:00
|
|
|
getParams(media?: MediaDTO): { [key: string]: string } {
|
2018-11-28 23:49:33 +01:00
|
|
|
const query: { [key: string]: string } = {};
|
2018-11-04 19:28:32 +01:00
|
|
|
if (media) {
|
2018-11-30 15:36:42 +01:00
|
|
|
query[QueryParams.gallery.photo] = media.name;
|
2018-05-26 20:49:55 -04:00
|
|
|
}
|
|
|
|
if (this.shareService.isSharing()) {
|
2018-11-30 15:36:42 +01:00
|
|
|
query[QueryParams.gallery.sharingKey_short] = this.shareService.getSharingKey();
|
2018-05-26 20:49:55 -04:00
|
|
|
}
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|