removed derived atom from async cookies atom (#259)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { getOrElse } from 'fp-ts/lib/Either'
|
||||
import { pipe } from 'fp-ts/lib/function'
|
||||
import { atom } from 'jotai'
|
||||
import { atomWithStorage } from 'jotai/utils'
|
||||
import { ffetch } from '../lib/httpClient'
|
||||
import { CustomTemplate } from '../types'
|
||||
import { serverSideCookiesState, serverURL } from './settings'
|
||||
import { atom } from 'jotai'
|
||||
import { atomWithStorage } from 'jotai/utils'
|
||||
|
||||
export const cookiesTemplateState = atom<Promise<string>>(async (get) =>
|
||||
await get(serverSideCookiesState)
|
||||
@@ -22,12 +22,6 @@ export const filenameTemplateState = atomWithStorage(
|
||||
localStorage.getItem('lastFilenameTemplate') ?? ''
|
||||
)
|
||||
|
||||
export const downloadTemplateState = atom<Promise<string>>(async (get) =>
|
||||
`${get(customArgsState)} ${await get(cookiesTemplateState)}`
|
||||
.replace(/ +/g, ' ')
|
||||
.trim()
|
||||
)
|
||||
|
||||
export const savedTemplatesState = atom<Promise<CustomTemplate[]>>(async (get) => {
|
||||
const task = ffetch<CustomTemplate[]>(`${get(serverURL)}/api/v1/template/all`)
|
||||
const either = await task()
|
||||
|
||||
Reference in New Issue
Block a user