import { Context } from "@nuxt/types/app";
import { RootState } from "~/store";

export default function (context: Context) {
	// if(context.route.fullPath.startsWith('/authenticate')) {
	// 	return;
	// }

	const state: RootState = context.store.state;

	if(state.config.installing) {
		context.redirect('/install');
	} else if (!state.isAuthed && !state.config.allowAnonymous) {
		context.redirect('/authenticate');
	}
}