2018-05-27 08:49:55 +08:00
|
|
|
import {Injectable} from '@angular/core';
|
|
|
|
import {ShareService} from '../gallery/share.service';
|
|
|
|
import {PhotoDTO} from '../../../common/entities/PhotoDTO';
|
2018-11-05 02:28:32 +08:00
|
|
|
import {MediaDTO} from '../../../common/entities/MediaDTO';
|
2018-05-27 08:49:55 +08:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class QueryService {
|
|
|
|
|
|
|
|
public static readonly PHOTO_PARAM = 'p';
|
|
|
|
|
|
|
|
constructor(private shareService: ShareService) {
|
|
|
|
}
|
|
|
|
|
2018-11-05 02:28:32 +08:00
|
|
|
getParams(media?: MediaDTO): { [key: string]: string } {
|
2018-05-27 08:49:55 +08:00
|
|
|
const query = {};
|
2018-11-05 02:28:32 +08:00
|
|
|
if (media) {
|
|
|
|
query[QueryService.PHOTO_PARAM] = media.name;
|
2018-05-27 08:49:55 +08:00
|
|
|
}
|
|
|
|
if (this.shareService.isSharing()) {
|
|
|
|
query['sk'] = this.shareService.getSharingKey();
|
|
|
|
}
|
|
|
|
return query;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|