<script setup>
import ctxRef from "@/utils/ctx_ref.js"
import Context from "./index.js"
import PostForm from "@/components/form/PostForm.vue";
import SubmitButton from "@/components/form/SubmitButton.vue";
import HTTPAuthConfigBox from "@/components/server/HTTPAuthConfigBox.vue";
import {ref} from "vue";
import ServerSettingLayout from "@/layouts/ServerSettingLayout.vue";
import ServerFeatureRequired from "@/components/server/ServerFeatureRequired.vue";

const authForm = ref()
const ctx = ctxRef(new Context(), {
	refs: {authForm}
})

</script>

<template>
	<ServerSettingLayout :ctx="ctx">
		<div v-if="ctx.featureIsOn">
			<PostForm action="$" @success="ctx.success" ref="authForm">
				<input type="hidden" name="webId" :value="ctx.webId">
				<HTTPAuthConfigBox :v-auth-config="ctx.authConfig" @change="ctx.changeMethods"></HTTPAuthConfigBox>
				<SubmitButton @ref="" class="mt-4"></SubmitButton>
			</PostForm>
		</div>
		<div v-if="!ctx.featureIsOn">
			<ServerFeatureRequired>尚未为当前用户开通此功能。</ServerFeatureRequired>
		</div>
	</ServerSettingLayout>
</template>

<style lang="postcss" scoped>
</style>