import axios from 'axios'

export default function (route, resourceId) {
	//In which case resourceId is really the username
	if(route === 'userPosts' || route === 'userThreads') {
		axios
			.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'user/' + resourceId)
			.then(res => {
				return axios
					.post(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'log', {
						route,
						resourceId: res.data.id
					})
			})
			.catch(console.log)
	} else {
		axios
			.post(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'log', {
				route,
				resourceId
			})
			.catch(console.log)
	}


}
