Refactoring.

This commit is contained in:
John Livingston
2023-09-21 17:13:28 +02:00
parent 567a5e80ab
commit cc673bd3cb
4 changed files with 150 additions and 125 deletions

View File

@ -1,7 +1,6 @@
import type { RegisterClientOptions } from '@peertube/peertube-types/client'
import { renderConfigurationHome } from './templates/home'
import { renderConfigurationChannel } from './templates/channel'
import { vivifyConfigurationChannel } from './logic/channel'
/**
* Registers stuff related to the user's configuration pages.
@ -25,14 +24,7 @@ async function registerConfiguration (clientOptions: RegisterClientOptions): Pro
onMount: async ({ rootEl }) => {
const urlParams = new URLSearchParams(window.location.search)
const channelId = urlParams.get('channelId') ?? ''
const html = await renderConfigurationChannel(clientOptions, channelId)
if (!html) {
// renderConfigurationChannel has already used the notifier to display an error
rootEl.innerHTML = ''
return
}
rootEl.innerHTML = html
await vivifyConfigurationChannel(clientOptions, rootEl, channelId)
await renderConfigurationChannel(clientOptions, channelId, rootEl)
}
})