slightly better status, internationalization
This commit is contained in:
		
							parent
							
								
									7c5acad535
								
							
						
					
					
						commit
						a06dd22da4
					
				
					 22 changed files with 2416 additions and 1009 deletions
				
			
		| 
						 | 
				
			
			@ -6,24 +6,24 @@ import { ref } from "vue";
 | 
			
		|||
const localStorageKey = "vulpine-oauth-app";
 | 
			
		||||
 | 
			
		||||
export const useAppStore = defineStore("oauth-app", () => {
 | 
			
		||||
    const json = localStorage.getItem(localStorageKey)
 | 
			
		||||
    const app = ref<Application>(json ? JSON.parse(json) : undefined);
 | 
			
		||||
	const json = localStorage.getItem(localStorageKey);
 | 
			
		||||
	const app = ref<Application>(json ? JSON.parse(json) : undefined);
 | 
			
		||||
 | 
			
		||||
    async function getApp() {
 | 
			
		||||
        if (app.value) return app.value;
 | 
			
		||||
	async function getApp() {
 | 
			
		||||
		if (app.value) return app.value;
 | 
			
		||||
 | 
			
		||||
        const resp = await apiFetch<Application>("/api/v1/apps", {
 | 
			
		||||
            method: "POST",
 | 
			
		||||
            body: {
 | 
			
		||||
                client_name: "vulpine-fe",
 | 
			
		||||
                redirect_uris: `${window.location.origin}/auth/callback`,
 | 
			
		||||
                scopes: "read write follow push",
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
        app.value = resp;
 | 
			
		||||
        localStorage.setItem(localStorageKey, JSON.stringify(resp));
 | 
			
		||||
        return app.value;
 | 
			
		||||
    }
 | 
			
		||||
		const resp = await apiFetch<Application>("/api/v1/apps", {
 | 
			
		||||
			method: "POST",
 | 
			
		||||
			body: {
 | 
			
		||||
				client_name: "vulpine-fe",
 | 
			
		||||
				redirect_uris: `${window.location.origin}/auth/callback`,
 | 
			
		||||
				scopes: "read write follow push",
 | 
			
		||||
			},
 | 
			
		||||
		});
 | 
			
		||||
		app.value = resp;
 | 
			
		||||
		localStorage.setItem(localStorageKey, JSON.stringify(resp));
 | 
			
		||||
		return app.value;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    return { app, getApp }
 | 
			
		||||
})
 | 
			
		||||
	return { app, getApp };
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue