rewrite client providing & fix sign in redirect
This commit is contained in:
		
							parent
							
								
									f82788495f
								
							
						
					
					
						commit
						00fa334d42
					
				
					 5 changed files with 106 additions and 53 deletions
				
			
		| 
						 | 
				
			
			@ -1,9 +1,6 @@
 | 
			
		|||
import { persistentAtom } from "@nanostores/persistent";
 | 
			
		||||
import { useStore } from "@nanostores/solid";
 | 
			
		||||
import { useNavigate } from "@solidjs/router";
 | 
			
		||||
import { createOAuthAPIClient, createRestAPIClient } from "masto";
 | 
			
		||||
import { action } from "nanostores";
 | 
			
		||||
import { createRenderEffect } from "solid-js";
 | 
			
		||||
 | 
			
		||||
export type Account = {
 | 
			
		||||
  site: string;
 | 
			
		||||
| 
						 | 
				
			
			@ -175,15 +172,3 @@ export const getOrRegisterApp = action(
 | 
			
		|||
    return all[site];
 | 
			
		||||
  },
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
export function useAccts() {
 | 
			
		||||
  const accts = useStore($accounts);
 | 
			
		||||
  const naviagte = useNavigate();
 | 
			
		||||
 | 
			
		||||
  createRenderEffect(() => {
 | 
			
		||||
    if (accts().length > 0) return;
 | 
			
		||||
    naviagte("/accounts/sign-in");
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  return accts;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue