mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
25 lines
586 B
TypeScript
25 lines
586 B
TypeScript
|
import {Injectable} from '@angular/core';
|
||
|
import {ShareService} from '../gallery/share.service';
|
||
|
import {PhotoDTO} from '../../../common/entities/PhotoDTO';
|
||
|
|
||
|
@Injectable()
|
||
|
export class QueryService {
|
||
|
|
||
|
public static readonly PHOTO_PARAM = 'p';
|
||
|
|
||
|
constructor(private shareService: ShareService) {
|
||
|
}
|
||
|
|
||
|
getParams(photo?: PhotoDTO): { [key: string]: string } {
|
||
|
const query = {};
|
||
|
if (photo) {
|
||
|
query[QueryService.PHOTO_PARAM] = photo.name;
|
||
|
}
|
||
|
if (this.shareService.isSharing()) {
|
||
|
query['sk'] = this.shareService.getSharingKey();
|
||
|
}
|
||
|
return query;
|
||
|
}
|
||
|
|
||
|
}
|