Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

516 B
Raw Blame
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 (error) {
    const axiosError = error as AxiosError;
    if (axiosError && axiosError.response?.status === 400) return;

    throw error;
  }
}