simplify some things

This commit is contained in:
Hailey
2024-06-17 18:57:18 -07:00
parent e9fafaf744
commit 3e203bc458
2 changed files with 10 additions and 10 deletions
+10 -9
View File
@@ -1,22 +1,23 @@
import React from 'react'
import {parseStarterPackHttpUri} from 'lib/strings/starter-pack'
import {useSetCurrentStarterPack} from 'state/preferences/starter-pack'
export function useStarterPackEntry() {
const setCurrentStarterPack = useSetCurrentStarterPack()
React.useEffect(() => {
const url = new URL(window.location.href)
if (url.pathname.startsWith('/start/')) {
const [_, _start, name, rkey] = url.pathname.split('/')
const href = window.location.href
const parsed = parseStarterPackHttpUri(href)
if (parsed) {
const url = new URL(href)
const isClip = url.searchParams.get('clip') === 'true'
if (name && rkey) {
setCurrentStarterPack({
uri: window.location.href,
isClip,
})
}
setCurrentStarterPack({
uri: href,
isClip,
})
}
}, [setCurrentStarterPack])
-1
View File
@@ -5,7 +5,6 @@ import * as persisted from '#/state/persisted'
type StateContext =
| {
uri: string
cid?: string
initialFeed?: string
isClip?: boolean
}