-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64c21c5
commit d173b04
Showing
21 changed files
with
210 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { queryTrpc } from '../../trpc'; | ||
|
||
export const useSetTripVisibility = () => { | ||
const utils = queryTrpc.useUtils(); | ||
const mutation = queryTrpc.setTripVisibility.useMutation(); | ||
|
||
const setTripVisibility = ( | ||
updatedTrip, | ||
options?: { onSuccess?: (queryUtils: typeof utils) => void }, | ||
) => { | ||
mutation.mutate(updatedTrip, { | ||
onSuccess: () => { | ||
utils.getTrips.invalidate(); | ||
utils.getUserTripsFeed.invalidate(); | ||
utils.getSingleTrip.invalidate(); | ||
utils.getUserTrips.invalidate(); | ||
options?.onSuccess?.(utils); | ||
}, | ||
}); | ||
}; | ||
|
||
return { | ||
setTripVisibility, | ||
...mutation, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { queryTrpc } from '../../trpc'; | ||
|
||
export const useSetPackVisibility = () => { | ||
const utils = queryTrpc.useUtils(); | ||
const mutation = queryTrpc.editPack.useMutation(); | ||
|
||
const setPackVisibility = ( | ||
updatePack: { id: string; is_public: boolean; name: string }, | ||
options?: { onSuccess?: (queryUtils: typeof utils) => void }, | ||
) => { | ||
mutation.mutate(updatePack, { | ||
onSuccess: () => { | ||
utils.getUserFavorites.invalidate(); | ||
utils.getUserPacksFeed.invalidate(); | ||
utils.getPublicFeed.invalidate(); | ||
options?.onSuccess?.(utils); | ||
}, | ||
}); | ||
}; | ||
|
||
return { | ||
setPackVisibility, | ||
...mutation, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import moment from 'moment'; | ||
|
||
export const formatTripDate = (date: string) => { | ||
return moment(date, 'MM/DD/YYYY'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.