refactor(desktop): update SharePanel and UrlBuilder for improved share URL handling
- Refactored SharePanel to retrieve the share URL directly from the entry data. - Enhanced UrlBuilder with a new method for generating share URLs that includes view and subscription parameters. - Updated the shareEntry method to utilize the new structure for better flexibility. Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export class UrlBuilder {
|
||||
constructor(private readonly webUrl: string) {}
|
||||
private join(path: string, query?: Record<string, string>) {
|
||||
protected join(path: string, query?: Record<string, string>) {
|
||||
const nextUrl = new URL(this.webUrl)
|
||||
nextUrl.pathname = path
|
||||
if (query) {
|
||||
@@ -17,10 +17,6 @@ export class UrlBuilder {
|
||||
return this.join(`share/lists/${id}`, view ? { view: view.toString() } : undefined)
|
||||
}
|
||||
|
||||
shareEntry(id: string) {
|
||||
return this.join(`timeline/view-0/all/${id}`, { share: "1" })
|
||||
}
|
||||
|
||||
profile(id: string) {
|
||||
return this.join(`share/users/${id}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user