Skip to content

Commit

Permalink
fix vite env ci
Browse files Browse the repository at this point in the history
  • Loading branch information
upiksaleh committed Oct 11, 2023
1 parent d56e573 commit 1106b11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import {dropFileComponent} from "./lib/drop-file-component";
import './editor';
import * as PusherPushNotifications from "@pusher/push-notifications-web";

window.appOnLoad = (userId, beamsIsEnabled) => {
if (beamsIsEnabled) {
window.appOnLoad = (config) => {
const {userId, pusherBeamsInstanceId} = config;
if (pusherBeamsInstanceId) {
const beamsTokenProvider = new PusherPushNotifications.TokenProvider({
url: `/app/pusher/beams-auth/${userId}`,
});
const beamsClient = new PusherPushNotifications.Client({
instanceId: import.meta.env.VITE_PUSHER_BEAMS_INSTANCE_ID,
instanceId: pusherBeamsInstanceId,
});
beamsClient
.start()
Expand Down
5 changes: 4 additions & 1 deletion resources/views/components/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
@vite($viteAssets)
</head>
<body class="bg-base-200"
onload="window.appOnLoad({{Auth::id()}}, {{intval(config('services.pusher.beams_enabled'))}})">
onload="window.appOnLoad(@js([
"userId"=>Auth::id(),
"pusherBeamsInstanceId"=> config('services.pusher.beams_enabled') && config('services.pusher.beams_instance_id') ? config('services.pusher.beams_instance_id') : null
]))">
<div class="drawer lg:drawer-open ">
<input id="drawer" type="checkbox" class="drawer-toggle">
<div class="drawer-content flex flex-col min-h-screen">
Expand Down

0 comments on commit 1106b11

Please sign in to comment.