Skip to content

Instantly share code, notes, and snippets.

import Axios from "axios";
import { API_URL } from "../models/constants";
export const uploadImage = async (token, imageUrl) => {
const fileBlob = await urlToObject(imageUrl);
var bodyFormData = new FormData();
bodyFormData.append('file', fileBlob);
import React, { useState } from 'react';
import getToken from '../api_client/auth';
import { uploadImage } from '../api_client/files';
import { createUser } from '../api_client/user';
import '../App.css';
const CreateUserPage = () => {
const [publicName, setPublicName] = useState("");
const [password, setPassword] = useState("");
const [email, setEmail] = useState("");
<?php
/**
* This is a short snapshot to show an idea. The complete project is tored here:
* https://github.com/wildroo/medium/blob/main/react_php_task
*/
class UserHelper{
private $usersTable = "users";
private $profilesTable = "profiles";
<?php
header("Content-Type: application/json; charset=UTF-8");
include_once '../config/dbconfig.php';
include_once '../helpers/userHelper.php';
$db = new DBClass();
$userHelper = new UserHelper();
//$data = $connection->query('SELECT NOW()');
//print_r($data);
@wildroo
wildroo / dbconfig.php
Created July 5, 2021 04:21
DB Config PHP File
<?php
class DBClass {
private $host = "<your_host>";
private $username = "<your_user_name>";
private $password = "<your_passowrd>";
private $database = "<your_db_name>";
public $connection;