forked from noxious/client
Returned data update
This commit is contained in:
parent
179ceb0ca0
commit
9c105d6df6
@ -6,8 +6,8 @@ import { getDomain } from '@/utilities'
|
||||
export async function register(username: string, email: string, password: string) {
|
||||
try {
|
||||
const response = await axios.post(`${config.server_endpoint}/register`, { username, email, password })
|
||||
useCookies().set('token', response.data.token as string)
|
||||
return { success: true, token: response.data.token }
|
||||
useCookies().set('token', response.data.data.token as string)
|
||||
return { success: true, token: response.data.data.token }
|
||||
} catch (error: any) {
|
||||
if (typeof error.response?.data === 'undefined') {
|
||||
return { error: 'Could not connect to server' }
|
||||
@ -19,10 +19,10 @@ export async function register(username: string, email: string, password: string
|
||||
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, {
|
||||
useCookies().set('token', response.data.data.token as string, {
|
||||
domain: getDomain()
|
||||
})
|
||||
return { success: true, token: response.data.token }
|
||||
return { success: true, token: response.data.data.token }
|
||||
} catch (error: any) {
|
||||
if (typeof error.response?.data === 'undefined') {
|
||||
return { error: 'Could not connect to server' }
|
||||
@ -34,7 +34,7 @@ export async function login(username: string, password: string) {
|
||||
export async function resetPassword(email: string) {
|
||||
try {
|
||||
const response = await axios.post(`${config.server_endpoint}/reset-password`, { email })
|
||||
return { success: true, token: response.data.token }
|
||||
return { success: true, token: response.data.data.token }
|
||||
} catch (error: any) {
|
||||
if (typeof error.response?.data === 'undefined') {
|
||||
return { error: 'Could not connect to server' }
|
||||
@ -46,7 +46,7 @@ export async function resetPassword(email: string) {
|
||||
export async function newPassword(urlToken: string, password: string) {
|
||||
try {
|
||||
const response = await axios.post(`${config.server_endpoint}/new-password`, { urlToken, password })
|
||||
return { success: true, token: response.data.token }
|
||||
return { success: true, token: response.data.data.token }
|
||||
} catch (error: any) {
|
||||
if (typeof error.response?.data === 'undefined') {
|
||||
return { error: 'Could not connect to server' }
|
||||
|
Loading…
x
Reference in New Issue
Block a user