Skip to content

Instantly share code, notes, and snippets.

@hamzamu
Created November 16, 2022 18:05
Show Gist options
  • Save hamzamu/6898eaa6a7e2282636fc4ca756448321 to your computer and use it in GitHub Desktop.
Save hamzamu/6898eaa6a7e2282636fc4ca756448321 to your computer and use it in GitHub Desktop.
next.ddp.js
import Head from 'next/head';
import { useState, useEffect } from 'react';
import 'tailwindcss/tailwind.css';
import DashboardLayout from '../dashboard/layout';
import { createClass } from 'asteroid';
function MyApp({ Component, pageProps }) {
// HELLOZ
useEffect(() => {
const Asteroid = createClass();
// Connect to a Meteor backend
const asteroid = new Asteroid({
endpoint: 'ws://localhost:3033/websocket',
});
asteroid
.call('helloddp')
.then((result) => {
console.log('Success');
console.log(result);
})
.catch((error) => {
console.log('Error');
console.error(error);
});
}, []);
return (
<>
<Head>
<title>Salvia-kit Dashboard v4 Next.js</title>
</Head>
<DashboardLayout>
<Component {...pageProps} />
</DashboardLayout>
</>
);
}
export default MyApp;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment