#190 : Cookie domain improvement
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import axios from 'axios'
|
||||
import config from '@/config'
|
||||
import { useCookies } from '@vueuse/integrations/useCookies'
|
||||
import { getDomain } from '@/utilities'
|
||||
|
||||
export async function register(username: string, email: string, password: string) {
|
||||
try {
|
||||
@ -16,9 +17,7 @@ export async function login(username: string, password: string) {
|
||||
try {
|
||||
const response = await axios.post(`${config.server_endpoint}/login`, { username, password })
|
||||
useCookies().set('token', response.data.token as string, {
|
||||
// for whole domain
|
||||
// @TODO : #190
|
||||
// domain: window.location.hostname.split('.').slice(-2).join('.')
|
||||
domain: getDomain()
|
||||
})
|
||||
return { success: true, token: response.data.token }
|
||||
} catch (error: any) {
|
||||
|
Reference in New Issue
Block a user