feat: sites and authors integration into existing screens (& formated all frontend files kinda accidentally)
This commit is contained in:
1 parent
3d81d2c717
commit
6b8990c55e
239 files changed
+9194
-1354
No files matched your search
@@ -99,7 +99,12 @@ export function authorsFixture(withEmails = true): Author[] {
|
||||
slug: 'ines-duarte',
|
||||
bio: 'Site manager and restoration carpenter.',
|
||||
website: 'https://ines-duarte.example',
|
||||
social_links: [{ type: 'linkedin', url: 'https://www.linkedin.com/in/ines-duarte' }],
|
||||
social_links: [
|
||||
{
|
||||
type: 'linkedin',
|
||||
url: 'https://www.linkedin.com/in/ines-duarte',
|
||||
},
|
||||
],
|
||||
user_id: 3,
|
||||
is_linked: true,
|
||||
article_count: 9,
|
||||
@@ -166,7 +171,7 @@ function pageOf(backend: Backend, query: URLSearchParams) {
|
||||
}
|
||||
}
|
||||
|
||||
function defaultRoute(backend: Backend, call: Call): unknown {
|
||||
export function defaultRoute(backend: Backend, call: Call): unknown {
|
||||
const { method, path, query, body } = call
|
||||
const siteMatch = /^\/v1\/site\/(\d+)(\/default)?$/.exec(path)
|
||||
const authorMatch = /^\/v1\/author\/(\d+)$/.exec(path)
|
||||
@@ -219,7 +224,12 @@ function defaultRoute(backend: Backend, call: Call): unknown {
|
||||
return pageOf(backend, query)
|
||||
}
|
||||
if (method === 'POST' && path === '/v1/author/') {
|
||||
const created = { id: 200, is_linked: body?.user_id != null, article_count: 0, ...body }
|
||||
const created = {
|
||||
id: 200,
|
||||
is_linked: body?.user_id != null,
|
||||
article_count: 0,
|
||||
...body,
|
||||
}
|
||||
backend.authors.push(created as unknown as Author)
|
||||
return created
|
||||
}
|
||||
@@ -340,7 +350,9 @@ export async function mountDirectory(
|
||||
await router.push(url)
|
||||
const component = view === 'sites' ? SitesView : AuthorsView
|
||||
kit.wrapper = mount(
|
||||
defineComponent({ render: () => h(UApp, null, { default: () => h(component) }) }),
|
||||
defineComponent({
|
||||
render: () => h(UApp, null, { default: () => h(component) }),
|
||||
}),
|
||||
{ attachTo: document.body, global: { plugins: [router, uiPlugin] } },
|
||||
)
|
||||
await flushPromises()
|
||||
|
||||
Reference in new issue
Block a user