mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-25 18:13:52 +03:00
Cleanup
This commit is contained in:
parent
67de09345d
commit
ee7c6dec2f
@ -23,8 +23,6 @@ function createUserGetter(): Query<void, AuthUser | null> {
|
|||||||
try {
|
try {
|
||||||
const response = await api.get(getMeRoute.path)
|
const response = await api.get(getMeRoute.path)
|
||||||
const userData = superjsonDeserialize<AuthUserData | null>(response.data)
|
const userData = superjsonDeserialize<AuthUserData | null>(response.data)
|
||||||
// TODO: figure out why overloading is not working
|
|
||||||
// @ts-ignore
|
|
||||||
return makeAuthUserIfPossible(userData)
|
return makeAuthUserIfPossible(userData)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.response?.status === 401) {
|
if (error.response?.status === 401) {
|
||||||
|
@ -211,11 +211,9 @@ function makeOptimisticUpdateMutationFn<Input, Output, CachedData>(
|
|||||||
return (function performActionWithOptimisticUpdates(item: Input) {
|
return (function performActionWithOptimisticUpdates(item: Input) {
|
||||||
const specificOptimisticUpdateDefinitions = optimisticUpdateDefinitions.map(
|
const specificOptimisticUpdateDefinitions = optimisticUpdateDefinitions.map(
|
||||||
(generalDefinition) =>
|
(generalDefinition) =>
|
||||||
// @ts-ignore
|
|
||||||
getOptimisticUpdateDefinitionForSpecificItem(generalDefinition, item)
|
getOptimisticUpdateDefinitionForSpecificItem(generalDefinition, item)
|
||||||
);
|
);
|
||||||
return (actionFn as InternalAction<Input, Output>).internal(
|
return (actionFn as InternalAction<Input, Output>).internal(
|
||||||
// @ts-ignore
|
|
||||||
item,
|
item,
|
||||||
specificOptimisticUpdateDefinitions
|
specificOptimisticUpdateDefinitions
|
||||||
);
|
);
|
||||||
@ -273,7 +271,6 @@ function makeRqOptimisticUpdateOptions<ActionInput, CachedData>(
|
|||||||
|
|
||||||
// Attempt to optimistically update the cache using the new value.
|
// Attempt to optimistically update the cache using the new value.
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
|
||||||
queryClient.setQueryData(queryKey, updateQuery);
|
queryClient.setQueryData(queryKey, updateQuery);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(
|
console.error(
|
||||||
|
@ -18,7 +18,7 @@ import {
|
|||||||
// Details here: https://github.com/wasp-lang/wasp/issues/2017
|
// Details here: https://github.com/wasp-lang/wasp/issues/2017
|
||||||
export function makeQueryCacheKey<Input, Output>(
|
export function makeQueryCacheKey<Input, Output>(
|
||||||
query: Query<Input, Output>,
|
query: Query<Input, Output>,
|
||||||
payload?: Input
|
payload: Input
|
||||||
): (string | Input)[] {
|
): (string | Input)[] {
|
||||||
return payload !== undefined ?
|
return payload !== undefined ?
|
||||||
[...query.queryCacheKey, payload]
|
[...query.queryCacheKey, payload]
|
||||||
|
@ -93,4 +93,4 @@ type ClientOperationWithNonAnyInput<Input, Output> =
|
|||||||
? (args?: unknown) => Promise<Output>
|
? (args?: unknown) => Promise<Output>
|
||||||
: [Input] extends [void]
|
: [Input] extends [void]
|
||||||
? () => Promise<Output>
|
? () => Promise<Output>
|
||||||
: (args?: Input) => Promise<Output>
|
: (args: Input) => Promise<Output>
|
||||||
|
Loading…
Reference in New Issue
Block a user