Chapter 1: Projects
Get all projects
First, the user should check if there are any existing projects in their account. Projects are required to import files into (e.g. folders). There are two possible scenarios:
The user already has projects
- Retrieve all projects associated with the user using the
getAllProjects
query, with the example code provided below.
import axios from "axios";
export const GET_ALL_PROJECTS = `
query GetAllProjects{
getAllProjects{
slug
name
}
}
`;
const getAllProjects = async () => {
try {
const response = await axios({
method: "POST",
url: "https://your-graphql-endpoint.com/graphql",
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.VUE_APP_API_KEY,
},
data: JSON.stringify({
query: GET_ALL_PROJECTS,
}),
});
console.log('Projects:', response.data.data.getAllProjects);
} catch (error) {
console.error('Error fetching presigned URL:', error);
}
};
getAllProjects();
- Once the projects are available, the user can navigate to a specific project to view its protocols.
For this, refer to thegetProtocolsByProjectSlug
query.
The user needs to create a new project
- If no projects exist, the user can create a new one using the
createProject
mutation.
Have questions?
Still have questions? Talk to support.