Files
linkwarden/e2e/data/user.ts
T
daniel31x13 dbd096ab76 Revert "undo commit"
This reverts commit 9103f67db5.
2024-11-03 03:27:52 -05:00

20 lines
493 B
TypeScript

import axios, { AxiosError } from "axios"
axios.defaults.baseURL = "http://localhost:3000"
export async function seedUser (username?: string, password?: string, name?: string) {
try {
return await axios.post("/api/v1/users", {
username: username || "test",
password: password || "password",
name: name || "Test User",
})
} catch (e: any) {
if (e instanceof AxiosError) {
if (e.response?.status === 400) {
return
}
}
throw e
}
}