feat(web): add accepting subscription invites from UI

This commit is contained in:
Karol Sójko
2022-10-24 14:30:17 +02:00
parent a4245aee6f
commit 0c44ad6c8e
14 changed files with 218 additions and 17 deletions

View File

@@ -5,6 +5,7 @@ import {
InternalEventBusInterface,
} from '@standardnotes/services'
import { RootQueryParam } from './RootQueryParam'
import { RouteParser } from './RouteParser'
import { RouteParserInterface } from './RouteParserInterface'
import { RouteServiceEvent } from './RouteServiceEvent'
@@ -30,13 +31,13 @@ export class RouteService
this.unsubApp()
}
public getRoute(): RouteParserInterface {
getRoute(): RouteParserInterface {
return new RouteParser(window.location.href)
}
public removeSettingsFromURLQueryParameters() {
removeQueryParameterFromURL(param: RootQueryParam): void {
const urlSearchParams = new URLSearchParams(window.location.search)
urlSearchParams.delete('settings')
urlSearchParams.delete(param)
const newUrl = `${window.location.origin}${window.location.pathname}${urlSearchParams.toString()}`
window.history.replaceState(null, document.title, newUrl)

View File

@@ -1,7 +1,8 @@
import { RootQueryParam } from './RootQueryParam'
import { RouteParserInterface } from './RouteParserInterface'
export interface RouteServiceInterface {
deinit(): void
getRoute(): RouteParserInterface
removeSettingsFromURLQueryParameters(): void
removeQueryParameterFromURL(param: RootQueryParam): void
}

View File

@@ -0,0 +1,12 @@
import { addToast, ToastType } from '@standardnotes/toast'
import { ToastServiceInterface } from './ToastServiceInterface'
export class ToastService implements ToastServiceInterface {
showToast(type: ToastType, message: string): void {
addToast({
type: type,
message,
})
}
}

View File

@@ -0,0 +1,5 @@
import { ToastType } from '@standardnotes/toast'
export interface ToastServiceInterface {
showToast(type: ToastType, message: string): void
}

View File

@@ -8,7 +8,9 @@ export * from './Route/Params/OnboardingParams'
export * from './Route/Params/PurchaseParams'
export * from './Route/Params/SettingsParams'
export * from './Route/Params/SubscriptionInviteParams'
export * from './Route/RootQueryParam'
export * from './Route/RouteParser'
export * from './Route/RouteParserInterface'
export * from './Route/RouteType'
export * from './Route/RouteService'
export * from './Route/RouteServiceInterface'
@@ -16,3 +18,5 @@ export * from './Route/RouteServiceEvent'
export * from './Security/AutolockService'
export * from './Storage/LocalStorage'
export * from './Theme/ThemeManager'
export * from './Toast/ToastService'
export * from './Toast/ToastServiceInterface'