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

// Middlewhich which only allows unauthenticated
// users to view a page.

export default function (context: Context) {

	const state: RootState = context.store.state;

	if (state.isAuthed) {
		if(context.route.path == '/') {
			return;
		}

		context.redirect('/');
	}
}