feat: rewrite auth (#364)
* feat: wip rewrite auth * feat: restructure folders and fix stories and tests * feat: remove auth provider and fix tests
This commit is contained in:
16
front/src/modules/utils/promise-to-observable.ts
Normal file
16
front/src/modules/utils/promise-to-observable.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { Observable } from '@apollo/client';
|
||||
|
||||
export const promiseToObservable = <T>(promise: Promise<T>) =>
|
||||
new Observable<T>((subscriber) => {
|
||||
promise.then(
|
||||
(value) => {
|
||||
if (subscriber.closed) {
|
||||
return;
|
||||
}
|
||||
|
||||
subscriber.next(value);
|
||||
subscriber.complete();
|
||||
},
|
||||
(err) => subscriber.error(err),
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user