[offers][fix] Fix test pages

pull/491/head
Bryann Yeap Kok Keong 3 years ago
parent 6f2e8e7a2d
commit 4c07889a75

@ -4,6 +4,20 @@ import { trpc } from '~/utils/trpc';
function Test() { function Test() {
const [createdData, setCreatedData] = useState(''); const [createdData, setCreatedData] = useState('');
const [cities, setCities] = useState<
Array<{
id: string;
name: string;
state: {
country: {
id: string;
name: string;
};
id: string;
name: string;
};
}>
>([]);
const [error, setError] = useState(''); const [error, setError] = useState('');
const createMutation = trpc.useMutation(['offers.profile.create'], { const createMutation = trpc.useMutation(['offers.profile.create'], {
@ -89,6 +103,15 @@ function Test() {
}); });
}; };
trpc.useQuery(['locations.cities.list', { name: 'Singapore' }], {
onError(err) {
alert(err);
},
onSuccess(data) {
setCities(data);
},
});
const handleClick = () => { const handleClick = () => {
createMutation.mutate({ createMutation.mutate({
background: { background: {
@ -128,11 +151,11 @@ function Test() {
}, },
offers: [ offers: [
{ {
cityId: cities[0].id,
comments: 'I am a Raffles Institution almumni', comments: 'I am a Raffles Institution almumni',
// Comments: '', // Comments: '',
companyId: 'cl9j4yawz0003utlp1uaa1t8o', companyId: 'cl9j4yawz0003utlp1uaa1t8o',
jobType: 'FULLTIME', jobType: 'FULLTIME',
location: 'Singapore, Singapore',
monthYearReceived: new Date('2022-09-30T07:58:54.000Z'), monthYearReceived: new Date('2022-09-30T07:58:54.000Z'),
negotiationStrategy: 'Leveraged having multiple offers', negotiationStrategy: 'Leveraged having multiple offers',
offersFullTime: { offersFullTime: {
@ -157,10 +180,10 @@ function Test() {
}, },
}, },
{ {
cityId: cities[0].id,
comments: '', comments: '',
companyId: 'cl9j4yawz0003utlp1uaa1t8o', companyId: 'cl9j4yawz0003utlp1uaa1t8o',
jobType: 'FULLTIME', jobType: 'FULLTIME',
location: 'Singapore, Singapore',
monthYearReceived: new Date('2022-09-30T07:58:54.000Z'), monthYearReceived: new Date('2022-09-30T07:58:54.000Z'),
negotiationStrategy: 'Leveraged having multiple offers', negotiationStrategy: 'Leveraged having multiple offers',
offersFullTime: { offersFullTime: {
@ -315,6 +338,7 @@ function Test() {
isEditable: true, isEditable: true,
offers: [ offers: [
{ {
cityId: cities[0].id,
comments: 'this IS SO IEUHDAEUIGDI', comments: 'this IS SO IEUHDAEUIGDI',
company: { company: {
createdAt: new Date('2022-10-12T16:19:05.196Z'), createdAt: new Date('2022-10-12T16:19:05.196Z'),
@ -329,7 +353,6 @@ function Test() {
companyId: 'cl9j4yawz0003utlp1uaa1t8o', companyId: 'cl9j4yawz0003utlp1uaa1t8o',
id: 'cl9i68fve000ntthj5h9yvqnh', id: 'cl9i68fve000ntthj5h9yvqnh',
jobType: 'FULLTIME', jobType: 'FULLTIME',
location: 'Singapore, Singapore',
monthYearReceived: new Date('2022-09-30T07:58:54.000Z'), monthYearReceived: new Date('2022-09-30T07:58:54.000Z'),
negotiationStrategy: 'Charmed the guy with my face', negotiationStrategy: 'Charmed the guy with my face',
offersFullTime: { offersFullTime: {

@ -1,14 +1,38 @@
import React from 'react'; import React from 'react';
import { useState } from 'react';
import { trpc } from '~/utils/trpc'; import { trpc } from '~/utils/trpc';
function Test() { function Test() {
const [cities, setCities] = useState<
Array<{
id: string;
name: string;
state: {
country: {
id: string;
name: string;
};
id: string;
name: string;
};
}>
>([]);
trpc.useQuery(['locations.cities.list', { name: 'Singapore' }], {
onError(err) {
alert(err);
},
onSuccess(data) {
setCities(data);
},
});
const data = trpc.useQuery([ const data = trpc.useQuery([
'offers.list', 'offers.list',
{ {
cityId: cities[0].id,
currency: 'SGD', currency: 'SGD',
limit: 100, limit: 100,
location: 'Singapore, Singapore',
offset: 0, offset: 0,
sortBy: '-totalCompensation', sortBy: '-totalCompensation',
yoeCategory: 2, yoeCategory: 2,

Loading…
Cancel
Save