+
Username: {smug_user.user.username}
+
Email: {smug_user.user.email}
+
Name: {smug_user.user.first_name} {smug_user.user.last_name}
+
{smug_user.business_owner ? "Current user is business owner" : "Current user is a standard user"}
+
User is staff? {smug_user.user.is_staff ? "Yes" : "No"}
+
+
+ >
+)
}
\ No newline at end of file
diff --git a/src/tags/PhotosByTag.js b/src/tags/PhotosByTag.js
index 9e5aa19..727678e 100644
--- a/src/tags/PhotosByTag.js
+++ b/src/tags/PhotosByTag.js
@@ -1,6 +1,33 @@
import React, {useState, useEffect} from "react";
import { useHistory,useParams } from "react-router-dom";
+import { getImageData } from "../images/MyImageManager";
+import { getTags } from "./TagManager";
export const PhotosByTag = () => {
-
+ const [ imageData, setImageData] = useState([])
+ const [ tagdata, settagdata ] = useState([])
+
+ useEffect(
+ () => {
+ getImageData().then(data => setImageData(data))
+ },[]
+ )
+
+ return(
+ <>
+
+
+ {tagscopy.map((tagname) => {
+ return(
+ <>
+ {changefunction(e) }
+ } />
+
+ >
+ )
+ }
+ )
+
+ }
+ < button onClick = {
+ () => {
+ const submitOBJ = {image_tags:tag_selections}
+ addTagsToImages( submitOBJ, id)
+ }
+ }
+
+
+ >Submit
+
+
+ >
)
}
\ No newline at end of file
diff --git a/src/tags/TagManager.js b/src/tags/TagManager.js
index afc05a0..b743760 100644
--- a/src/tags/TagManager.js
+++ b/src/tags/TagManager.js
@@ -1,5 +1,5 @@
export const getTags = () => {
- return fetch("http://localhost:8000/tags", {
+ return fetch("http://localhost:8000/image_tags", {
headers:{
"Authorization": `Token ${localStorage.getItem("sf_token")}`
}
@@ -10,7 +10,7 @@ export const getTags = () => {
export const createTags = (tag) => {
- return fetch(`http://localhost:8000/events`, {
+ return fetch(`http://localhost:8000/image_tags`, {
method: "POST",
headers:{
"Authorization": `Token ${localStorage.getItem("sf_token")}`,
@@ -21,4 +21,16 @@ export const createTags = (tag) => {
)
.then(response => response.json())
+ }
+
+ export const addTagsToImages = (tag_selections,id) => {
+ return fetch(`http://localhost:8000/images/${id}`, {
+ method: "PUT",
+ headers:{
+ "Authorization": `Token ${localStorage.getItem("sf_token")}`,
+ "Content-Type": "Application/json"
+ },
+ body:JSON.stringify(tag_selections)
+ }
+ )
}
\ No newline at end of file