1
0
forked from noxious/client

Notifications bug fix

This commit is contained in:
2024-06-06 19:17:02 +02:00
parent 01bbd94a3e
commit 356cb94cc2
3 changed files with 10 additions and 10 deletions

View File

@ -15,14 +15,12 @@ export async function register(username: string, password: string, socketStore =
}
export async function login(username: string, password: string, socketStore = useSocketStore()) {
const response = await axios.post(`${config.server_endpoint}/login`, { username, password })
console.log(response.status, response.data);
if (response.status !== 200) {
return { error: response.data.message }
try {
const response = await axios.post(`${config.server_endpoint}/login`, { username, password })
useCookies().set('token', response.data.token as string)
await socketStore.setupSocketConnection()
return { success: true }
} catch (error: any) {
return { error: error.response.data.message }
}
useCookies().set('token', response.data.token as string)
await socketStore.setupSocketConnection()
return { success: true }
}