push
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import * as Notifications from 'expo-notifications'
|
||||
import { Platform } from 'react-native'
|
||||
import { trpc } from './trpc'
|
||||
import { queryClient } from './trpc'
|
||||
import { getApiBaseUrl } from './api-url'
|
||||
|
||||
Notifications.setNotificationHandler({
|
||||
handleNotification: async () => ({
|
||||
@@ -30,11 +29,8 @@ export async function setupPushNotifications() {
|
||||
projectId: process.env.EXPO_PUBLIC_PROJECT_ID,
|
||||
})
|
||||
|
||||
// Store push token on the server
|
||||
// We call the tRPC mutation to save the token
|
||||
const caller = trpc.createClient as never
|
||||
// Simple fetch to avoid circular deps:
|
||||
const apiUrl = process.env.EXPO_PUBLIC_API_URL ?? 'http://localhost:3000'
|
||||
// Store push token on the server.
|
||||
const apiUrl = getApiBaseUrl()
|
||||
await fetch(`${apiUrl}/api/push-token`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
|
||||
Reference in New Issue
Block a user