Files
photon-tbw/src/lib/promise.ts
T
Xylight 5651ad475d feat: use state based auth instead of store based (#488)
* misc: switch to state for auth

* fix: class based auth not working
2025-02-08 13:49:09 -08:00

10 lines
264 B
TypeScript

// to allow for loading before promises are finished on the client.
import { browser } from '$app/environment'
export const awaitIfServer = async <T>(
promise: Promise<T>,
): Promise<{
data: Promise<T> | T
}> => ({ data: browser ? promise : await promise })