This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BroadcastChannel, createLeaderElection } from 'broadcast-channel' | |
import React from 'react' | |
const channels = {} | |
export function useBroadcastLeader(id = 'default') { | |
const [isBroadcastLeader, setIsBroadcastLeader] = React.useState(false) | |
React.useEffect(() => { | |
if (!channels[id]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const auth = require('@feathersjs/authentication'); | |
const errors = require('@feathersjs/errors'); | |
const bcrypt = require('bcryptjs'); | |
const comparePasswords = (oldPassword, password) => new Promise((resolve, reject) => { | |
bcrypt.compare(oldPassword, password, (err, data1) => { | |
if(err || !data1) return reject(); | |
return resolve(); | |
}); | |
}); |