import { BetterAuthClientPlugin } from 'better-auth/types';
import type { bankIDPlugin } from './plugin-server';
import { atom, onMount, task } from 'nanostores';
export const bankIDPluginClient = () => {
return {
id: 'bankid-plugin',
$inferServerPlugin: {} as ReturnType<typeof bankIDPlugin>,
getAtoms: ($fetch) => {
const myAtom = atom({});
onMount(myAtom, () => {
task(() =>
// get the correct endpoint from the plugin
$fetch('auth/bankid/start', { method: 'POST' })
.then(console.log)
);
});
return { myAtom };
}
} satisfies BetterAuthClientPlugin;
};
import { BetterAuthClientPlugin } from 'better-auth/types';
import type { bankIDPlugin } from './plugin-server';
import { atom, onMount, task } from 'nanostores';
export const bankIDPluginClient = () => {
return {
id: 'bankid-plugin',
$inferServerPlugin: {} as ReturnType<typeof bankIDPlugin>,
getAtoms: ($fetch) => {
const myAtom = atom({});
onMount(myAtom, () => {
task(() =>
// get the correct endpoint from the plugin
$fetch('auth/bankid/start', { method: 'POST' })
.then(console.log)
);
});
return { myAtom };
}
} satisfies BetterAuthClientPlugin;
};