import Cookies from "js-cookie"
import baseURL from "./app"
let AccessToken = "vue_admin_template_token_"
const uid = "vue_admin_template_load_uid_"
const name = "vue_admin_template_name_"

let role = "vue_admin_template_role_"
let email = "vue_admin_template_email_"

//token
export function getToken() {
	return Cookies.get(AccessToken)
}
export function setToken(data) {
	return Cookies.set(AccessToken, data, {
		path: "/",
		domain: baseURL.DomainName
	})
}
export function CreateTenant(data) {
	return Cookies.set("isCreateTenant", data, {
		path: "/",
		domain: baseURL.DomainName
	})
}
export function removeToken() {
	return Cookies.remove(AccessToken, { path: "/", domain: baseURL.DomainName })
}

//uid
export function getUid() {
	return Cookies.get(uid)
}
export function setUid(data) {
	return Cookies.set(uid, data, { path: "/", domain: baseURL.DomainName })
}
export function removeUid() {
	return Cookies.remove(uid, { path: "/", domain: baseURL.DomainName })
}

//name
export function getName() {
	return Cookies.get(name)
}
export function setName(data) {
	return Cookies.set(name, data, { path: "/", domain: baseURL.DomainName })
}
export function removeName() {
	return Cookies.remove(name, { path: "/", domain: baseURL.DomainName })
}

//tenantId
export function getTenantId() {
	return Cookies.get("tenantId")
}
export function setTenantId(data) {
	return Cookies.set("tenantId", data, {
		path: "/",
		domain: baseURL.DomainName
	})
}
export function removeTenantId() {
	return Cookies.remove("tenantId", { path: "/", domain: baseURL.DomainName })
}

//role角色
export function getRole() {
	return Cookies.get(role)
}
export function setRole(data) {
	return Cookies.set(role, data, { path: "/", domain: baseURL.DomainName })
}
export function removeRole() {
	return Cookies.remove(role, { path: "/", domain: baseURL.DomainName })
}

//email
export function getEmail() {
	return Cookies.get(email)
}
export function setEmail(data) {
	return Cookies.set(email, data, { path: "/", domain: baseURL.DomainName })
}
export function removeEmail() {
	return Cookies.remove(email, { path: "/", domain: baseURL.DomainName })
}
