mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
initial provider
This commit is contained in:
29
framework/medusa/auth/use-logout.tsx
Normal file
29
framework/medusa/auth/use-logout.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import { MutationHook } from '@commerce/utils/types'
|
||||
import useLogout, { UseLogout } from '@commerce/auth/use-logout'
|
||||
import { useCallback } from 'react'
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
export default useLogout as UseLogout<typeof handler>
|
||||
|
||||
export const handler: MutationHook<any> = {
|
||||
fetchOptions: {
|
||||
query: 'auth',
|
||||
method: 'logout',
|
||||
},
|
||||
async fetcher({ options, fetch }) {
|
||||
await fetch({ ...options })
|
||||
|
||||
return null
|
||||
},
|
||||
useHook:
|
||||
({ fetch }) =>
|
||||
() => {
|
||||
return useCallback(
|
||||
async function logout(input) {
|
||||
const data = await fetch({ input })
|
||||
return data
|
||||
},
|
||||
[fetch]
|
||||
)
|
||||
},
|
||||
}
|
Reference in New Issue
Block a user