mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: refactor the entire learnhouse project
This commit is contained in:
parent
f556e41dda
commit
4c215e91d5
247 changed files with 7716 additions and 1013 deletions
42
apps/web/services/install/install.ts
Normal file
42
apps/web/services/install/install.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, errorHandling } from "@services/utils/ts/requests";
|
||||
|
||||
export async function updateInstall(body: any, step: number) {
|
||||
const result = await fetch(`${getAPIUrl()}install/update?step=${step}`, RequestBody("POST", body, null));
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function createNewOrgInstall(body: any) {
|
||||
const result = await fetch(`${getAPIUrl()}install/org`, RequestBody("POST", body, null));
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function createNewUserInstall(body: any) {
|
||||
const result = await fetch(`${getAPIUrl()}install/user?org_slug=${body.org_slug}`, RequestBody("POST", body, null));
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function createSampleDataInstall(username: string, org_slug: string) {
|
||||
const result = await fetch(`${getAPIUrl()}install/sample?username=${username}&org_slug=${org_slug}`, RequestBody("POST", null, null));
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function createDefaultElements() {
|
||||
const result = await fetch(`${getAPIUrl()}install/default_elements`, RequestBody("POST", null, null));
|
||||
const res = await errorHandling(result);
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function isInstallModeEnabled() {
|
||||
const result = await fetch(`${getAPIUrl()}install/latest`, RequestBody("GET", null, null));
|
||||
if (result.status === 200 || result.status === 404) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue