This repository has been archived on 2024-10-25. You can view files and clone it, but cannot push or open issues or pull requests.
CrunchyDL/components/Crunchyroll/Account.ts

30 lines
769 B
TypeScript
Raw Normal View History

2024-04-16 20:20:30 +02:00
import type { CrunchyLogin } from './Types'
export async function crunchyLogin() {
const { data, error } = await useFetch<CrunchyLogin>('http://localhost:8080/api/crunchyroll/login', {
method: 'POST'
})
return { data, error }
}
export async function checkAccount(service: string) {
const { data, error } = await useFetch<CrunchyLogin>(`http://localhost:8080/api/service/check/${service}`, {
2024-04-16 20:20:30 +02:00
method: 'GET'
})
return { data, error }
}
export async function loginAccount(user: string, password: string, service: string) {
const { data, error } = await useFetch<CrunchyLogin>(`http://localhost:8080/api/service/login/${service}`, {
2024-04-16 20:20:30 +02:00
method: 'POST',
body: {
user: user,
password: password
}
})
return { data, error }
}