{
- // Redirect to login page if a login is required
- // You can also do other things here like show a modal before redirecting
- window.location.href = await auth.getLoginUrl(error)
- },
-})
-
-/**
- * Make an authenticated request to a server using the standard fetch API.
- * Will redirect to the login page instead if the user needs to log in.
- *
- * @param url The URL for the request
- * @param options Additional request options.
- * @returns The fetch response
- */
-export async function authFetch(url: string, options?: RequestInit) {
- const headers = new Headers(options?.headers)
-
- // Set the authorization header with the Feathers Auth token
- headers.set('Authorization', await auth.getHeader())
-
- return fetch(url, {
- ...options,
- headers,
- })
-}
diff --git a/svelte-chat/src/automerge.ts b/svelte-chat/src/automerge.ts
deleted file mode 100644
index d8db100..0000000
--- a/svelte-chat/src/automerge.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { createAutomerge, DocHandle } from '@feathersdev/automerge'
-import { auth } from './auth.js'
-import type { ChatAppData } from './utils.js'
-
-/**
- * The Feathers Automerge client. Use it to retrieve the document
- * for your application with `automerge.find()`.
- */
-export const automerge = createAutomerge(auth)
-
-/**
- * The document handle type for the application
- */
-export type AppDocumentHandle = DocHandle
-
-/**
- * Load the document for the application
- */
-export async function loadAppDocument(): Promise {
- return automerge.find()
-}